-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--choose side pane not using correct just file #1638
Comments
The default preview command for the chooser ( It is possible to get the preview working by updating the chooser command: $ export JUST_CHOOSER= "fzf --multi --preview 'just -f my_justfile --show {}'"
$ just -f my_justfile --choose Locally, I "fixed" it with the following patch: diff --git a/src/subcommand.rs b/src/subcommand.rs
index 99dacec47041..5d08b55d562d 100644
--- a/src/subcommand.rs
+++ b/src/subcommand.rs
@@ -213,10 +213,19 @@ impl Subcommand {
return Err(Error::NoChoosableRecipes);
}
+ let preview_file = match justfile.default {
+ Some(ref default) => format!(" -f {}'", default.name.path.display()),
+ None => "'".into(),
+ };
+
+ let mut default_chooser = OsString::from(config::CHOOSER_DEFAULT.strip_suffix("'")
+ .unwrap_or(config::CHOOSER_DEFAULT));
+ default_chooser.push(preview_file);
+
let chooser = chooser
.map(OsString::from)
.or_else(|| env::var_os(config::CHOOSER_ENVIRONMENT_KEY))
- .unwrap_or_else(|| OsString::from(config::CHOOSER_DEFAULT));
+ .unwrap_or_else(|| default_chooser);
let result = justfile
.settings But trimming and modifying the default chooser string is not a clean solution, there's probably something better to do here. |
How about changing
Doing the interpolation will be a little funny, you can't interpolate a |
Looks better than my version :)
I suspected something like that, but I'm not familiar enough with Rust and paths (or |
I think maybe you'll have to create an OsString, and then append to it. Like so: let mut chooser = OsString::new();
chooser.push("fzf --multi --preview 'just --justfile ");
chooser.push(path);
chooser.push(" --show {}'"); |
I have a non-default just file named eg
justfoo
, with a shebang line like#!/usr/bin/env just -f
When I run
./justfoo --choose
, the left pane lists justfoo's recipes, and they run correctly when selected. But the right pane seems to look for the defaultjustfile
instead, and shows error messages like "no justfile found" or "Justfile does not contain recipe ...". I expected it to show the recipes fromjustfoo
.Is this a bug ?
The text was updated successfully, but these errors were encountered: