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

Add --print-unicode-blocks and --verbose #23

Merged
merged 1 commit into from
Sep 27, 2024
Merged
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
22 changes: 22 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,35 @@ impl RuleDispatcher {
struct Args {
/// One or more files or directories to scan. Directories are scanned recursively.
paths: Vec<PathBuf>,

/// Print the names of all the Unicode blocks that this tool recognizes, then exits.
/// Enable verbose output to also print the code point ranges for each block.
#[arg(long)]
print_unicode_blocks: bool,

/// Enable more verbose output.
#[arg(short, long)]
verbose: bool,
}

fn main() -> anyhow::Result<()> {
env_logger::init();

let args = Args::parse();

if args.print_unicode_blocks {
for (&name, range) in &unicode_blocks::UNICODE_BLOCKS {
print!("{name}");
if args.verbose {
let range_start = u32::from(*range.start());
let range_end = u32::from(*range.end());
print!(": U+{range_start}..U+{range_end}");
}
println!();
}
return Ok(());
}

let default_config = get_default_config();
let mut dispatcher = RuleDispatcher {
user_config: None,
Expand Down
Loading