add --fetch-grammars and --build-grammars CLI flags

imgbot
Michael Davis 3 years ago committed by Blaž Hrastnik
parent c1f677ff75
commit 8330f6af20

@ -9,6 +9,8 @@ pub struct Args {
pub health: bool, pub health: bool,
pub health_arg: Option<String>, pub health_arg: Option<String>,
pub load_tutor: bool, pub load_tutor: bool,
pub fetch_grammars: bool,
pub build_grammars: bool,
pub verbosity: u64, pub verbosity: u64,
pub files: Vec<(PathBuf, Position)>, pub files: Vec<(PathBuf, Position)>,
pub edit_config: bool, pub edit_config: bool,
@ -32,6 +34,8 @@ impl Args {
args.health = true; args.health = true;
args.health_arg = argv.next_if(|opt| !opt.starts_with('-')); args.health_arg = argv.next_if(|opt| !opt.starts_with('-'));
} }
"--fetch-grammars" => args.fetch_grammars = true,
"--build-grammars" => args.build_grammars = true,
arg if arg.starts_with("--") => { arg if arg.starts_with("--") => {
anyhow::bail!("unexpected double dash argument: {}", arg) anyhow::bail!("unexpected double dash argument: {}", arg)
} }

@ -59,14 +59,16 @@ ARGS:
<files>... Sets the input file to use, position can also be specified via file[:row[:col]] <files>... Sets the input file to use, position can also be specified via file[:row[:col]]
FLAGS: FLAGS:
-h, --help Prints help information -h, --help Prints help information
--edit-config Opens the helix config file --edit-config Opens the helix config file
--tutor Loads the tutorial --tutor Loads the tutorial
--health [LANG] Checks for potential errors in editor setup --health [LANG] Checks for potential errors in editor setup
If given, checks for config errors in language LANG If given, checks for config errors in language LANG
-v Increases logging verbosity each use for up to 3 times --fetch-grammars Fetches tree-sitter grammars listed in languages.toml
(default file: {}) --build-grammars Builds tree-sitter grammars fetched with --fetch-grammars
-V, --version Prints version information -v Increases logging verbosity each use for up to 3 times
(default file: {})
-V, --version Prints version information
", ",
env!("CARGO_PKG_NAME"), env!("CARGO_PKG_NAME"),
env!("VERSION_AND_GIT_HASH"), env!("VERSION_AND_GIT_HASH"),

Loading…
Cancel
Save