Skip to content

Commit

Permalink
Improve capabilities of ion schema subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
popematt committed Oct 22, 2024
1 parent 6b4e9db commit 347175a
Show file tree
Hide file tree
Showing 8 changed files with 445 additions and 172 deletions.
34 changes: 32 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ keywords = ["format", "parse", "encode"]

[dependencies]
anyhow = "1.0"
clap = { version = "4.5.8", features = ["cargo", "env"] }
clap = { version = "4.5.8", features = ["cargo", "env","wrap_help"] }
colored = "2.0.0"
digest = "0.9"
sha2 = "0.9"
sha3 = "0.9"
flate2 = "1.0"
infer = "0.15.0"
ion-rs = { version = "1.0.0-rc.8", features = ["experimental", "experimental-ion-hash"] }
# ion-rs version must be pinned because we are using experimental features
# See https://github.com/amazon-ion/ion-cli/issues/155
ion-rs = { version = "=1.0.0-rc.8", features = ["experimental", "experimental-ion-hash"] }
tempfile = "3.2.0"
ion-schema = "0.14.0"
lowcharts = "0.5.8"
Expand Down
38 changes: 38 additions & 0 deletions src/bin/ion/commands/schema/check.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use crate::commands::schema::IonSchemaCommandInput;
use crate::commands::IonCliCommand;
use anyhow::Result;
use clap::{Arg, ArgAction, ArgMatches, Command};

pub struct CheckCommand;

impl IonCliCommand for CheckCommand {
fn name(&self) -> &'static str {
"check"
}

fn about(&self) -> &'static str {
"Loads a schema and checks it for problems."
}

fn is_stable(&self) -> bool {
false
}

fn configure_args(&self, command: Command) -> Command {
command.args(IonSchemaCommandInput::schema_args()).arg(
Arg::new("show-debug")
.short('D')
.long("show-debug")
.action(ArgAction::SetTrue),
)
}

fn run(&self, _command_path: &mut Vec<String>, args: &ArgMatches) -> Result<()> {
let ion_schema_input = IonSchemaCommandInput::read_from_args(args)?;
let schema = ion_schema_input.get_schema();
if args.get_flag("show-debug") {
println!("Schema: {:#?}", schema);
}
Ok(())
}
}
72 changes: 0 additions & 72 deletions src/bin/ion/commands/schema/load.rs

This file was deleted.

Loading

0 comments on commit 347175a

Please sign in to comment.