diff --git a/src/command_line.rs b/src/command_line.rs index e6db4b82..24d04038 100644 --- a/src/command_line.rs +++ b/src/command_line.rs @@ -12,40 +12,39 @@ use serde::Serialize; #[derive(Debug, Default, Parser)] #[command(rename_all = "kebab-case")] pub struct SliceOptions { - /// List of slice files to compile. + /// List of Slice files to compile. #[arg(required = true)] pub sources: Vec, - /// Files that are needed for referencing, but that no code should be generated for. - #[arg(short = 'R', long, num_args = 1, action = Append)] + /// Add a directory or Slice file to the list of references. + #[arg(short = 'R', value_name="REFERENCE", num_args = 1, action = Append)] pub references: Vec, - /// Preprocessor Symbols defined on the command line. - #[arg(short = 'D', long, num_args = 1, action = Append)] + /// Define a preprocessor definition. + #[arg(short = 'D', value_name="DEFINITION", num_args = 1, action = Append)] pub definitions: Vec, - /// Instructs the compiler to treat warnings as errors. - #[arg(short, long)] + /// Instruct the compiler to treat warnings as errors. + #[arg(short = 'W')] pub warn_as_error: bool, - /// Instructs the compiler to allow warnings. Specify a list of warnings to allow, or leave empty to allow all - /// warnings. - #[arg(long)] - pub allow_warnings: Option>, + /// Instruct the compiler to allow (not emit) the specified warning. + #[arg(short = 'A', long = "allow", value_name="WARNING", num_args = 1, action = Append)] + pub allowed_warnings: Option>, - /// Validates input files without generating code for them. + /// Validate input files without generating code for them. #[arg(long)] pub dry_run: bool, - /// Output directory for generated code, defaults to the current working directory. - #[arg(long)] + /// Set the output directory for the generated code. Defaults to the current working directory. + #[arg(short = 'O', long)] pub output_dir: Option, - /// Output format for emitted errors. + /// Set the output format for emitted errors. #[arg(value_enum, default_value_t = DiagnosticFormat::Human, long, ignore_case = true)] pub diagnostic_format: DiagnosticFormat, - /// Disables ANSI escape code for diagnostic output. + /// Disable ANSI color codes in diagnostic output. #[arg(long)] pub disable_color: bool, } diff --git a/src/diagnostics/diagnostic_reporter.rs b/src/diagnostics/diagnostic_reporter.rs index 4a36b535..429db79e 100644 --- a/src/diagnostics/diagnostic_reporter.rs +++ b/src/diagnostics/diagnostic_reporter.rs @@ -39,7 +39,7 @@ impl DiagnosticReporter { treat_warnings_as_errors: slice_options.warn_as_error, diagnostic_format: slice_options.diagnostic_format, disable_color: slice_options.disable_color, - allowed_warnings: slice_options.allow_warnings.clone(), + allowed_warnings: slice_options.allowed_warnings.clone(), } } diff --git a/tests/diagnostic_output_tests.rs b/tests/diagnostic_output_tests.rs index 690dcba9..a136c415 100644 --- a/tests/diagnostic_output_tests.rs +++ b/tests/diagnostic_output_tests.rs @@ -120,7 +120,7 @@ error [E010]: invalid enum 'E': enums must contain at least one enumerator // Set the output format to JSON. let options = SliceOptions { diagnostic_format: DiagnosticFormat::Json, - allow_warnings: Some(vec![]), + allowed_warnings: Some(vec![]), ..Default::default() }; @@ -151,7 +151,7 @@ error [E010]: invalid enum 'E': enums must contain at least one enumerator // Set the output format to JSON. let options = SliceOptions { diagnostic_format: DiagnosticFormat::Json, - allow_warnings: Some(vec!["W004".to_string()]), + allowed_warnings: Some(vec!["W004".to_string()]), ..Default::default() };