-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--cmd program argument to pass a sequence of commands
Right not I use it for tests & benchmarks
- Loading branch information
Showing
7 changed files
with
157 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "broot" | ||
version = "0.4.6" | ||
version = "0.4.7" | ||
authors = ["dystroy <[email protected]>"] | ||
repository = "https://github.com/Canop/broot" | ||
description = "Fuzzy Search + tree + cd" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,22 +38,33 @@ use toml; | |
use crate::app::App; | ||
use crate::app_context::AppContext; | ||
use crate::browser_states::BrowserState; | ||
use crate::commands::Command; | ||
use crate::conf::Conf; | ||
use crate::errors::ProgramError; | ||
use crate::external::Launchable; | ||
use crate::task_sync::TaskLifetime; | ||
use crate::tree_options::TreeOptions; | ||
use crate::verbs::VerbStore; | ||
|
||
const VERSION: &str = "0.4.6"; | ||
const VERSION: &str = "0.4.7"; | ||
|
||
// declare the possible CLI arguments, and gets the values | ||
fn get_cli_args<'a>() -> clap::ArgMatches<'a> { | ||
clap::App::new("broot") | ||
.version(VERSION) | ||
.author("dystroy <[email protected]>") | ||
.about("Balanced tree view + fuzzy search + BFS + customizable launcher") | ||
.arg(clap::Arg::with_name("root").help("sets the root directory")) | ||
.arg( | ||
clap::Arg::with_name("root") | ||
.help("sets the root directory") | ||
) | ||
.arg( | ||
clap::Arg::with_name("commands") | ||
.short("c") | ||
.long("cmd") | ||
.takes_value(true) | ||
.help("commands to execute (space separated, experimental)"), | ||
) | ||
.arg( | ||
clap::Arg::with_name("only-folders") | ||
.short("f") | ||
|
@@ -160,15 +171,19 @@ fn run() -> Result<Option<Launchable>, ProgramError> { | |
.value_of("output_path") | ||
.and_then(|s| Some(s.to_owned())), | ||
}; | ||
|
||
debug!("output path: {:?}", &con.output_path); | ||
|
||
let input_commands: Vec<Command> = match cli_args.value_of("commands") { | ||
Some(str) => str.split(' ').map(|s| Command::from(s.to_string())).collect(), | ||
None => Vec::new(), | ||
}; | ||
|
||
Ok( | ||
match BrowserState::new(path.clone(), tree_options, &TaskLifetime::unlimited()) { | ||
Some(bs) => { | ||
let mut app = App::new(); | ||
app.push(Box::new(bs)); | ||
app.run(&con)? | ||
app.run(&con, input_commands)? | ||
} | ||
_ => None, // should not happen, as the lifetime is "unlimited" | ||
}, | ||
|