From c8a8852b0aa1eb5f01ebfaa8116d1d334fcb0ae1 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 16 Dec 2023 07:07:57 +0800 Subject: [PATCH] yazi: pass additional args to ya alias This allows commands like `ya /etc/nixos` and `ya --help` to be used. (cherry picked from commit abdc82d930521448e47574b8ca1a0a450e861cca) --- modules/programs/yazi.nix | 8 ++++---- tests/modules/programs/yazi/bash-integration-enabled.nix | 2 +- tests/modules/programs/yazi/fish-integration-enabled.nix | 2 +- .../modules/programs/yazi/nushell-integration-enabled.nix | 4 ++-- tests/modules/programs/yazi/zsh-integration-enabled.nix | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/programs/yazi.nix b/modules/programs/yazi.nix index 1f1f5bb46..a3d687262 100644 --- a/modules/programs/yazi.nix +++ b/modules/programs/yazi.nix @@ -9,7 +9,7 @@ let bashIntegration = '' function ya() { tmp="$(mktemp -t "yazi-cwd.XXXXX")" - yazi --cwd-file="$tmp" + yazi "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then cd -- "$cwd" fi @@ -20,7 +20,7 @@ let fishIntegration = '' function ya set tmp (mktemp -t "yazi-cwd.XXXXX") - yazi --cwd-file="$tmp" + yazi $argv --cwd-file="$tmp" if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] cd -- "$cwd" end @@ -29,9 +29,9 @@ let ''; nushellIntegration = '' - def --env ya [] { + def --env ya [args?] { let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) - yazi --cwd-file $tmp + yazi $args --cwd-file $tmp let cwd = (open $tmp) if $cwd != "" and $cwd != $env.PWD { cd $cwd diff --git a/tests/modules/programs/yazi/bash-integration-enabled.nix b/tests/modules/programs/yazi/bash-integration-enabled.nix index d54bbb881..9a8c18bf2 100644 --- a/tests/modules/programs/yazi/bash-integration-enabled.nix +++ b/tests/modules/programs/yazi/bash-integration-enabled.nix @@ -4,7 +4,7 @@ let shellIntegration = '' function ya() { tmp="$(mktemp -t "yazi-cwd.XXXXX")" - yazi --cwd-file="$tmp" + yazi "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then cd -- "$cwd" fi diff --git a/tests/modules/programs/yazi/fish-integration-enabled.nix b/tests/modules/programs/yazi/fish-integration-enabled.nix index 155684d5f..02506b266 100644 --- a/tests/modules/programs/yazi/fish-integration-enabled.nix +++ b/tests/modules/programs/yazi/fish-integration-enabled.nix @@ -4,7 +4,7 @@ let shellIntegration = '' function ya set tmp (mktemp -t "yazi-cwd.XXXXX") - yazi --cwd-file="$tmp" + yazi $argv --cwd-file="$tmp" if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] cd -- "$cwd" end diff --git a/tests/modules/programs/yazi/nushell-integration-enabled.nix b/tests/modules/programs/yazi/nushell-integration-enabled.nix index 7b353228b..aefffb9e2 100644 --- a/tests/modules/programs/yazi/nushell-integration-enabled.nix +++ b/tests/modules/programs/yazi/nushell-integration-enabled.nix @@ -2,9 +2,9 @@ let shellIntegration = '' - def --env ya [] { + def --env ya [args?] { let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) - yazi --cwd-file $tmp + yazi $args --cwd-file $tmp let cwd = (open $tmp) if $cwd != "" and $cwd != $env.PWD { cd $cwd diff --git a/tests/modules/programs/yazi/zsh-integration-enabled.nix b/tests/modules/programs/yazi/zsh-integration-enabled.nix index d27e868a1..ef7960c59 100644 --- a/tests/modules/programs/yazi/zsh-integration-enabled.nix +++ b/tests/modules/programs/yazi/zsh-integration-enabled.nix @@ -4,7 +4,7 @@ let shellIntegration = '' function ya() { tmp="$(mktemp -t "yazi-cwd.XXXXX")" - yazi --cwd-file="$tmp" + yazi "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then cd -- "$cwd" fi