diff --git a/Cargo.toml b/Cargo.toml index a9d227c..04a508f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,14 @@ temptree = "0.2.0" which = "4.0.0" yaml-rust = "0.4.5" +[lib] +doctest = false + +[[bin]] +path = "src/main.rs" +name = "just" +test = false + [features] # No features are active by default. default = [] diff --git a/man/just.1 b/man/just.1 index 74a294a..d0a9393 100644 --- a/man/just.1 +++ b/man/just.1 @@ -19,7 +19,7 @@ Run `\-\-fmt` in 'check' mode. Exits with 0 if justfile is formatted correctly. .TP \fB\-\-choose\fR Select one or more recipes to run using a binary. If `\-\-chooser` is not passed the -chooser defaults to the value of $JUST_CHOOSER, falling back to `fzf` +chooser defaults to the value of $JUST_CHOOSER, falling back to `fzf --preview 'just --show {}'` .TP \fB\-\-clear\-shell\-args\fR Clear shell arguments diff --git a/src/config.rs b/src/config.rs index e6d5def..069a9a8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -4,7 +4,7 @@ use { }; // These three strings should be kept in sync: -pub(crate) const CHOOSER_DEFAULT: &str = "fzf"; +pub(crate) const CHOOSER_DEFAULT: &str = "fzf --preview 'just --show {}'"; pub(crate) const CHOOSER_ENVIRONMENT_KEY: &str = "JUST_CHOOSER"; pub(crate) const CHOOSE_HELP: &str = "Select one or more recipes to run using a binary. If \ `--chooser` is not passed the chooser defaults to the value \ diff --git a/tests/choose.rs b/tests/choose.rs index 9dd0b19..ed74638 100644 --- a/tests/choose.rs +++ b/tests/choose.rs @@ -151,7 +151,9 @@ fn invoke_error_function() { echo bar ", ) - .stderr_regex("error: Chooser `/ -cu fzf` invocation failed: .*\n") + .stderr_regex( + r"error: Chooser `/ -cu fzf --preview 'just --show \{\}'` invocation failed: .*\n", + ) .status(EXIT_FAILURE) .shell(false) .args(["--shell", "/", "--choose"]) @@ -213,6 +215,7 @@ fn default() { let output = Command::new(executable_path("just")) .arg("--choose") + .arg("--chooser=fzf") .current_dir(tmp.path()) .env("PATH", path) .output()