-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve capabilities of ion schema subcommands
- Loading branch information
Showing
8 changed files
with
445 additions
and
172 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(()) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.