feat: help users migrate shell key bindings to v0.3

I hit an issue in my config and found the existing migration error
messages slightly confusing.

My issue was that I had key bindings using `--interactive` and `--block`
at the same time, which seems to be disallowed in v0.3.

d2c8040760
This commit is contained in:
Mika Vilpas 2024-07-17 20:05:26 +03:00
parent ed6ae000d6
commit 872d9a285b
3 changed files with 7 additions and 3 deletions

View file

@ -33,6 +33,8 @@ impl Control {
if let Some(ref s) = self.desc { Cow::Borrowed(s) } else { self.run().into() }
}
pub fn key_desc(&self) -> String { format!("`{}` ({})", self.on(), self.desc_or_run()) }
#[inline]
pub fn contains(&self, s: &str) -> bool {
let s = s.to_lowercase();

View file

@ -65,10 +65,12 @@ pub fn init() -> anyhow::Result<()> {
continue;
}
if !r.bool("confirm") && !r.bool("interactive") {
let key_desc = c.key_desc();
eprintln!(
r#"WARNING: In Yazi v0.3, the behavior of the interactive `shell` (i.e., shell templates) must be explicitly specified with `--interactive`.
r#"WARNING: In Yazi v0.3, the behavior of the interactive `shell` (i.e., shell templates) must be explicitly specified with either `--interactive` or `--confirm`.
Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` with `shell "my-template" --interactive`, in your keymap.toml"#
Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` with `shell "my-template" --interactive`, in your keymap.toml
for the key {key_desc}"#
);
return Ok(());
} else if r.bool("confirm") && r.bool("interactive") {

View file

@ -38,7 +38,7 @@ impl Tab {
if !opt.interactive && !opt.confirm {
AppProxy::notify_error(
"`shell` command",
r#"In Yazi v0.3, the behavior of the interactive `shell` (i.e., shell templates) must be explicitly specified with `--interactive`.
r#"WARNING: In Yazi v0.3, the behavior of the interactive `shell` (i.e., shell templates) must be explicitly specified with either `--interactive` or `--confirm`.
Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` with `shell "my-template" --interactive`, in your keymap.toml"#,
);