From 88b65739521e2e9b92475acf6a3665b78bc357d3 Mon Sep 17 00:00:00 2001 From: Chris Toph Date: Sun, 27 Apr 2025 15:53:13 -0400 Subject: [PATCH] Fixed infinite freeze --- functions/__yay_tar.fish | 2 +- functions/yay.fish | 56 +++++++++++++++++++++++----------------- pkgs/default.nix | 9 ++++--- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/functions/__yay_tar.fish b/functions/__yay_tar.fish index 3e1527f..aff5faa 100644 --- a/functions/__yay_tar.fish +++ b/functions/__yay_tar.fish @@ -15,7 +15,7 @@ function __yay_tar echo " -v, --verbose Enable verbose output" echo " -h, --help Show this help message" echo "" - echo "Supported compression types: :D" + echo "Supported compression types:" echo " 7zip - .7z or .tar.7z (levels: 0-9, default 5, threads: yes)" echo " bzip2 - .tar.bz2 (levels: 1-9, default 9)" echo " bzip3 - .tar.bz3 (block size in MiB: 1-511, default 16, threads: yes)" diff --git a/functions/yay.fish b/functions/yay.fish index def1673..aa4babe 100644 --- a/functions/yay.fish +++ b/functions/yay.fish @@ -1,26 +1,34 @@ #!/usr/bin/env fish -# Main dispatch -if test (count $argv) -eq 0 - echo "Usage: yay [args]" - echo "Commands: rebuild, update, garbage, try, tar, untar" - exit 1 - end - - switch $argv[1] - case rebuild - __yay_rebuild $argv[2..-1]; or exit $status - case update - __yay_update $argv[2..-1]; or exit $status - case garbage - __yay_garbage; or exit $status - case try - __yay_try $argv[2..-1]; or exit $status - case tar - __yay_tar $argv[2..-1]; or exit $status - case untar - __yay_untar $argv[2..-1]; or exit $status - case '*' - __yay_red "Unknown subcommand: $argv[1]" - exit 1 - end \ No newline at end of file +function yay_function + # Main dispatch + if test (count $argv) -eq 0 + echo "yay! :D" + echo "Usage: yay [args]" + echo "Commands: rebuild, update, garbage, try, tar, untar" + exit 1 + end + + switch $argv[1] + case rebuild + __yay_rebuild $argv[2..-1]; or exit $status + case update + __yay_update $argv[2..-1]; or exit $status + case garbage + __yay_garbage; or exit $status + case try + __yay_try $argv[2..-1]; or exit $status + case tar + __yay_tar $argv[2..-1]; or exit $status + case untar + __yay_untar $argv[2..-1]; or exit $status + case '*' + __yay_red "Unknown subcommand: $argv[1]" + exit 1 + end +end + +# For direct fish shell usage +function yay + yay_function $argv +end \ No newline at end of file diff --git a/pkgs/default.nix b/pkgs/default.nix index 44cc5af..230ecb4 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -14,11 +14,11 @@ let cp ${../share/fish/completions}/yay.fish $out/share/fish/completions/ ''; - # Create main yay binary that ensures fish is available + # Create main yay binary that uses fish's function path yayBin = pkgs.writeShellScriptBin "yay" '' - exec ${pkgs.fish}/bin/fish -c "yay $*" + FUNCTIONS_DIR=$(dirname $(dirname $0))/share/fish/functions + exec ${lib.getExe pkgs.fish} -c "set fish_function_path \$fish_function_path $FUNCTIONS_DIR; source $FUNCTIONS_DIR/yay.fish; yay_function $@" ''; - in pkgs.symlinkJoin { name = "yay"; @@ -34,6 +34,7 @@ pkgs.symlinkJoin { wrapProgram $out/bin/yay \ --prefix PATH : ${ lib.makeBinPath [ + pkgs.fish pkgs.nh pkgs.jq pkgs.gzip @@ -52,4 +53,4 @@ pkgs.symlinkJoin { platforms = platforms.unix; maintainers = [ "Tophc7" ]; }; -} +} \ No newline at end of file