diff options
author | Matan Kushner <hello@matchai.me> | 2019-07-02 16:12:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-02 16:12:53 -0400 |
commit | 463ec260247fa0e62d2ea14e237681a499955392 (patch) | |
tree | 0d7ed8d19187c298c2e7764f21387a919d21877c /src/main.rs | |
parent | 2440ed60d0a315e6248c040d2a114f7deeea6260 (diff) |
feat: Add a `disabled` configuration option for modules (#86)
• Add support for the disabled configuration option
This will allow you to selectively disable modules that you don't want or need. 😄
• Overwrite starship configuration file path with STARSHIP_CONFIG environment variable
• Write tests for the two configuration options that are available
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/src/main.rs b/src/main.rs index 70f68e2e5..371109e50 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,20 @@ use clap::{App, Arg, SubCommand}; fn main() { pretty_env_logger::init(); + let status_code_arg = Arg::with_name("status_code") + .short("s") + .long("status") + .value_name("STATUS_CODE") + .help("The status code of the previously run command") + .takes_value(true); + + let path_arg = Arg::with_name("path") + .short("p") + .long("path") + .value_name("PATH") + .help("The path that the prompt should render for") + .takes_value(true); + let matches = App::new("Starship") .about("The cross-shell prompt for astronauts. ✨🚀") // pull the version number from Cargo.toml @@ -24,22 +38,8 @@ fn main() { .subcommand( SubCommand::with_name("prompt") .about("Prints the full starship prompt") - .arg( - Arg::with_name("status_code") - .short("s") - .long("status") - .value_name("STATUS_CODE") - .help("The status code of the previously run command") - .takes_value(true), - ) - .arg( - Arg::with_name("path") - .short("p") - .long("path") - .value_name("PATH") - .help("The path that the prompt should render for ($PWD by default)") - .takes_value(true), - ), + .arg(&status_code_arg) + .arg(&path_arg), ) .subcommand( SubCommand::with_name("module") @@ -49,22 +49,8 @@ fn main() { .help("The name of the module to be printed") .required(true), ) - .arg( - Arg::with_name("status_code") - .short("s") - .long("status") - .value_name("STATUS_CODE") - .help("The status code of the previously run command") - .takes_value(true), - ) - .arg( - Arg::with_name("path") - .short("p") - .long("path") - .value_name("PATH") - .help("The path the prompt should render for ($PWD by default)") - .takes_value(true), - ), + .arg(&status_code_arg) + .arg(&path_arg), ) .get_matches(); |