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

Fix boolean flags #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn main() {
let options = Options::parse();
let format_options = FormatOptions {
indent: Indent::Spaces(options.indent_spaces),
uppercase: options.uppercase.unwrap_or(true),
uppercase: options.uppercase,
lines_between_queries: options.lines_between_queries,
};

Expand Down Expand Up @@ -93,18 +93,18 @@ struct Options {
/// If no file paths are provided, reads from stdin.
file_paths: Vec<String>,
/// Check if the code is already formatted
#[clap(short, long)]
#[clap(short, long, num_args(0..=1))]
check: bool,
/// Set the number of spaces to use for indentation
#[clap(short, long, default_value = "4")]
indent_spaces: u8,
/// Change reserved keywords to ALL CAPS
#[clap(short = 'U', long)]
uppercase: Option<bool>,
/// Change reserved keywords to ALL CAPS, default true
#[clap(short = 'U', long, num_args(0..=1), default_value="true")]
uppercase: bool,
/// Set the number of line breaks after a query
#[clap(short, long, default_value = "2")]
lines_between_queries: u8,
/// Enforce a tailing newline at the end of the file
#[clap(short = 'n', long, default_value = "false")]
/// Enforce a trailing newline at the end of the file
#[clap(short = 'n', long, num_args(0..=1))]
trailing_newline: bool,
}