ion-cli icon indicating copy to clipboard operation
ion-cli copied to clipboard

Extract common value-handling logic for both `head` and `dump`

Open jobarr-amzn opened this issue 2 years ago • 0 comments

(Suggestion) We should probably shift head related logic to head.rs. Whatever part of dump we are reusing there we should create a helper method for that in dump.rs and then use it in head.rs.

Example:

// dump.rs
pub fn run() {
    ...
    write_ion_values(...) // a helper method that can also be used in head.rs
    ...
}

// head.rs
pub fn run() {
   ...
   // perform the values option(--values <n>) extraction here and use expect if the option is not found
   write_ion_values(...)
   ...
}

Originally posted by @desaikd in https://github.com/amazon-ion/ion-cli/pull/46#discussion_r1152418049

jobarr-amzn avatar Mar 29 '23 21:03 jobarr-amzn