Skip to content
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

Merged
merged 9 commits into from
Jul 2, 2024

Conversation

popematt
Copy link
Contributor

@popematt popematt commented Jul 2, 2024

Issue #, if available:

#85

Description of changes:

Changes are mostly broken up by commits

  • Removes the beta namespace
  • Removes the passthrough dump command in favor of using clap's alias feature to achieve the same effect.
  • Adds --unstable/-X to opt into experimental features.
  • Adds an is_porcelain() function to the IonCliCommand 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.
  • Adds --ion-version option

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

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.
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment on lines +28 to +43
/// 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
}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@jobarr-amzn jobarr-amzn left a 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.

@popematt popematt merged commit c47232b into amazon-ion:master Jul 2, 2024
4 checks passed
@popematt popematt deleted the ion-version-flag branch July 2, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants