mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
yazi: add shellWrapperName & rename wrappers to yy
The program shell wrappers have been renamed from `ya` to `yy` following the introduction of the new CLI tool named `ya`. With this in mind, the `shellWrapperName` option has been introduced to provide users with more flexibility in choosing the name they're most accustomed to (ra, lf, ...). Co-authored-by: XYenon <register@xyenon.bid> Co-authored-by: 三咲雅 · Misaki Masa <sxyazi@gmail.com>
This commit is contained in:
parent
d3bf2a0612
commit
92a26bf6df
6 changed files with 29 additions and 7 deletions
|
@ -1679,6 +1679,19 @@ in {
|
||||||
https://github.com/rafaelmardojai/blanket for more.
|
https://github.com/rafaelmardojai/blanket for more.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2024-06-26T07:07:17+00:00";
|
||||||
|
condition = with config.programs.yazi;
|
||||||
|
enable && (enableBashIntegration || enableZshIntegration
|
||||||
|
|| enableFishIntegration || enableNushellIntegration);
|
||||||
|
message = ''
|
||||||
|
Yazi's shell integration wrappers have been renamed from 'ya' to 'yy'.
|
||||||
|
|
||||||
|
A new option `programs.yazi.shellWrapperName` is also available that
|
||||||
|
allows you to override this name.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ let
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
bashIntegration = ''
|
bashIntegration = ''
|
||||||
function ya() {
|
function ${cfg.shellWrapperName}() {
|
||||||
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
|
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
|
||||||
yazi "$@" --cwd-file="$tmp"
|
yazi "$@" --cwd-file="$tmp"
|
||||||
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
||||||
|
@ -18,7 +18,7 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fishIntegration = ''
|
fishIntegration = ''
|
||||||
function ya
|
function ${cfg.shellWrapperName}
|
||||||
set tmp (mktemp -t "yazi-cwd.XXXXX")
|
set tmp (mktemp -t "yazi-cwd.XXXXX")
|
||||||
yazi $argv --cwd-file="$tmp"
|
yazi $argv --cwd-file="$tmp"
|
||||||
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||||
|
@ -29,7 +29,7 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nushellIntegration = ''
|
nushellIntegration = ''
|
||||||
def --env ya [...args] {
|
def --env ${cfg.shellWrapperName} [...args] {
|
||||||
let tmp = (mktemp -t "yazi-cwd.XXXXX")
|
let tmp = (mktemp -t "yazi-cwd.XXXXX")
|
||||||
yazi ...$args --cwd-file $tmp
|
yazi ...$args --cwd-file $tmp
|
||||||
let cwd = (open $tmp)
|
let cwd = (open $tmp)
|
||||||
|
@ -47,6 +47,15 @@ in {
|
||||||
|
|
||||||
package = mkPackageOption pkgs "yazi" { };
|
package = mkPackageOption pkgs "yazi" { };
|
||||||
|
|
||||||
|
shellWrapperName = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "yy";
|
||||||
|
example = "y";
|
||||||
|
description = ''
|
||||||
|
Name of the shell wrapper to be called.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
enableBashIntegration = mkEnableOption "Bash integration";
|
enableBashIntegration = mkEnableOption "Bash integration";
|
||||||
|
|
||||||
enableZshIntegration = mkEnableOption "Zsh integration";
|
enableZshIntegration = mkEnableOption "Zsh integration";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
shellIntegration = ''
|
shellIntegration = ''
|
||||||
function ya() {
|
function yy() {
|
||||||
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
|
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
|
||||||
yazi "$@" --cwd-file="$tmp"
|
yazi "$@" --cwd-file="$tmp"
|
||||||
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
shellIntegration = ''
|
shellIntegration = ''
|
||||||
function ya
|
function yy
|
||||||
set tmp (mktemp -t "yazi-cwd.XXXXX")
|
set tmp (mktemp -t "yazi-cwd.XXXXX")
|
||||||
yazi $argv --cwd-file="$tmp"
|
yazi $argv --cwd-file="$tmp"
|
||||||
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
shellIntegration = ''
|
shellIntegration = ''
|
||||||
def --env ya [...args] {
|
def --env yy [...args] {
|
||||||
let tmp = (mktemp -t "yazi-cwd.XXXXX")
|
let tmp = (mktemp -t "yazi-cwd.XXXXX")
|
||||||
yazi ...$args --cwd-file $tmp
|
yazi ...$args --cwd-file $tmp
|
||||||
let cwd = (open $tmp)
|
let cwd = (open $tmp)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
shellIntegration = ''
|
shellIntegration = ''
|
||||||
function ya() {
|
function yy() {
|
||||||
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
|
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
|
||||||
yazi "$@" --cwd-file="$tmp"
|
yazi "$@" --cwd-file="$tmp"
|
||||||
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
||||||
|
|
Loading…
Reference in a new issue