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

Update help message comments. Closes #517 #527

Merged
merged 12 commits into from
Apr 24, 2023
31 changes: 15 additions & 16 deletions src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,

/// 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<String>,

/// 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<String>,

/// 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<Vec<String>>,
/// 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<Vec<String>>,

/// 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<String>,

/// 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,
}
Expand Down
2 changes: 1 addition & 1 deletion src/diagnostics/diagnostic_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/diagnostic_output_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};

Expand Down Expand Up @@ -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()
};

Expand Down