ion-cli
ion-cli copied to clipboard
Printing generator warnings based on programming language
As per the suggestions in this thread:
- The fact that you have to make this change in two places is a bit of a code smell. It should be possible to do something like
let generator = match language { /*...*/ };outside of thematch args.get_one::<String>("schema"). - If we're going to be unconditionally printing some warnings, perhaps we can print to std err instead of std out, and then we also don't need to worry about coloring them, since the colors often show up as gibberish in text log files.
- Rather than having multiple
println!()in the print warnings functions, why not combine it into one multiline string? - Should the generator trait have a
print_implementation_notes()function? Then you can get the language specific generator and call the function on that instead of having to include it in the language matching branches. - To accomplish this, it might be helpful to have an
AnyLanguageenum that can delegate to the correct language (similar to theAnyEncodingenum inion-rust).
I think all of this can be addressed in a separate PR, though.
Originally posted by @popematt in https://github.com/amazon-ion/ion-cli/pull/148#discussion_r1803689035