Use just --show in default chooser (#1539)

This commit is contained in:
Li Ke 2023-01-28 16:24:54 +08:00 committed by GitHub
parent 941a40e051
commit 5f9ac39b03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 3 deletions

View File

@ -52,6 +52,14 @@ temptree = "0.2.0"
which = "4.0.0" which = "4.0.0"
yaml-rust = "0.4.5" yaml-rust = "0.4.5"
[lib]
doctest = false
[[bin]]
path = "src/main.rs"
name = "just"
test = false
[features] [features]
# No features are active by default. # No features are active by default.
default = [] default = []

View File

@ -19,7 +19,7 @@ Run `\-\-fmt` in 'check' mode. Exits with 0 if justfile is formatted correctly.
.TP .TP
\fB\-\-choose\fR \fB\-\-choose\fR
Select one or more recipes to run using a binary. If `\-\-chooser` is not passed the 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 .TP
\fB\-\-clear\-shell\-args\fR \fB\-\-clear\-shell\-args\fR
Clear shell arguments Clear shell arguments

View File

@ -4,7 +4,7 @@ use {
}; };
// These three strings should be kept in sync: // 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 CHOOSER_ENVIRONMENT_KEY: &str = "JUST_CHOOSER";
pub(crate) const CHOOSE_HELP: &str = "Select one or more recipes to run using a binary. If \ 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 \ `--chooser` is not passed the chooser defaults to the value \

View File

@ -151,7 +151,9 @@ fn invoke_error_function() {
echo bar 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) .status(EXIT_FAILURE)
.shell(false) .shell(false)
.args(["--shell", "/", "--choose"]) .args(["--shell", "/", "--choose"])
@ -213,6 +215,7 @@ fn default() {
let output = Command::new(executable_path("just")) let output = Command::new(executable_path("just"))
.arg("--choose") .arg("--choose")
.arg("--chooser=fzf")
.current_dir(tmp.path()) .current_dir(tmp.path())
.env("PATH", path) .env("PATH", path)
.output() .output()