diff options
author | Canop <cano.petrole@gmail.com> | 2020-01-14 18:47:54 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-01-14 18:47:54 +0100 |
commit | 9756d17d17587bb81985eecbca0335dc6a9715c5 (patch) | |
tree | 9560575c4098144588b15a3acf32000b65840a3b /src/cli.rs | |
parent | 42186bf348b6598092c07cb34949b6e232c1012f (diff) |
`--set-install-state` sets the installation state
This can be used in tests or manual installs to set the installation state.
For example, if you make an installation script which automatically
installs just the fish function in ~/sea, you may do
broot --set-install-state refused --print-shell-function fish > ~/sea/br.fish
Fix #148
Diffstat (limited to 'src/cli.rs')
-rw-r--r-- | src/cli.rs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -4,6 +4,7 @@ use { crate::{ errors::{ProgramError, TreeBuildError}, + shell_install::ShellInstallState, tree_options::{OptionBool, TreeOptions}, }, std::{ @@ -19,6 +20,7 @@ pub struct AppLaunchArgs { pub file_export_path: Option<String>, // where to write the produced path (if required with --out) pub cmd_export_path: Option<String>, // where to write the produced command (if required with --outcmd) pub print_shell_function: Option<String>, // shell function to print on stdout + pub set_install_state: Option<ShellInstallState>, // the state to set pub tree_options: TreeOptions, // initial tree options pub commands: Option<String>, // commands passed as cli argument, still unparsed pub install: bool, // installation is required @@ -96,11 +98,16 @@ pub fn read_launch_args() -> Result<AppLaunchArgs, ProgramError> { let print_shell_function = cli_args .value_of("print-shell-function") .map(str::to_string); + let set_install_state = cli_args + .value_of("set-install-state") + .map(ShellInstallState::from_str) + .transpose()?; Ok(AppLaunchArgs { root, file_export_path, cmd_export_path, print_shell_function, + set_install_state, tree_options, commands, install, |