-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds experimental --ion-version option #128
Conversation
non-goal. | ||
help Print this message or the help of the given subcommand(s) | ||
cat Prints all Ion input files to the specified output in the requested format. | ||
count (UNSTABLE) Prints the number of top-level values found in the input stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What makes count
unstable, anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea, but it was in the beta
namespace, so I'm leaving it as unstable for now. We can fix that in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it is possible that #104 could eventually replace count
, so maybe that's a good reason to leave it a "unstable" for now.
@@ -17,7 +17,12 @@ impl IonCliCommand for CatCommand { | |||
} | |||
|
|||
fn configure_args(&self, command: Command) -> Command { | |||
command.with_input().with_output().with_format() | |||
command | |||
.alias("dump") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
/// Indicates whether this command is stable (as opposed to unstable or experimental). | ||
/// Namespaces should almost always be stable. | ||
fn is_stable(&self) -> bool { | ||
true | ||
} | ||
|
||
/// Whether the output format is machine-readable. | ||
/// | ||
/// Commands that are "plumbing" should default to putting one output (result, value, document) | ||
/// on each line in a machine-readable format (file name, Ion value(s), integers, booleans) | ||
/// without any prose or table formatting, etc. | ||
/// | ||
/// See https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain#_plumbing_porcelain | ||
fn is_porcelain(&self) -> bool { | ||
false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the defaults be flipped here? I'd rather default to assuming that commands are unstable and porcelain, and have commands intentionally vouch that they are stable or plumbing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind flipping them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to approve it as-is, I'd like to change the default unstable/porcelain values but there's no need to couple that here.
Issue #, if available:
#85
Description of changes:
Changes are mostly broken up by commits
dump
command in favor of using clap'salias
feature to achieve the same effect.--unstable
/-X
to opt into experimental features.is_porcelain()
function to theIonCliCommand
trait. If implemented to return true, it gets a warning at the bottom of the command help that the output is not intended to be suitable for machine-readable use cases.--ion-version
optionBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.