New command features for try and update, and yay_run improvement
• Replaces raw eval with a safer fish shell command execution • Improves try commands with '--' separator for running one-shot commands • Adds support for updating a specific flake input via flag or positional argument • Updates documentation and completions for consistency and clarity
This commit is contained in:
parent
2ef2d5bf65
commit
3cfa7ed0e1
6 changed files with 234 additions and 131 deletions
61
flake.lock
generated
61
flake.lock
generated
|
@ -1,61 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1731533236,
|
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1745930157,
|
|
||||||
"narHash": "sha256-y3h3NLnzRSiUkYpnfvnS669zWZLoqqI6NprtLQ+5dck=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "46e634be05ce9dc6d4db8e664515ba10b78151ae",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
|
@ -1,11 +1,13 @@
|
||||||
function __yay_run
|
function __yay_run
|
||||||
set cmd $argv[1]
|
set -l cmd_string $argv[1]
|
||||||
__yay_yellow "→ $cmd"
|
__yay_yellow "→ $cmd_string"
|
||||||
eval $cmd
|
# Use fish -c for slightly safer execution than raw eval
|
||||||
if test $status -eq 0
|
fish -c "$cmd_string"
|
||||||
__yay_green "✔ $cmd"
|
set -l run_status $status
|
||||||
|
if test $run_status -eq 0
|
||||||
|
__yay_green "✔ $cmd_string"
|
||||||
else
|
else
|
||||||
__yay_red "✘ $cmd (exit $status)"
|
__yay_red "✘ $cmd_string (exit $run_status)"
|
||||||
return $status
|
return $run_status
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,12 +1,55 @@
|
||||||
function __yay_try
|
function __yay_try
|
||||||
|
set -l all_args $argv
|
||||||
|
|
||||||
set -l opts h/help
|
set -l opts h/help
|
||||||
argparse $opts -- $argv; or return
|
argparse $opts -- $all_args; or return
|
||||||
if set -q _flag_help; or test (count $argv) -eq 0
|
|
||||||
echo "Usage: yay try PACKAGE [PACKAGE...]"
|
if set -q _flag_help; or test (count $all_args) -eq 0
|
||||||
|
echo "Usage: yay try PACKAGE [PACKAGE...] [-- COMMAND [ARGS...]]"
|
||||||
echo " -h, --help Show this help message"
|
echo " -h, --help Show this help message"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Initialize variables in function scope
|
||||||
|
set -l pkgs
|
||||||
|
set -l cmd_str
|
||||||
|
set -l sep_index (contains --index -- '--' $all_args)
|
||||||
|
|
||||||
|
if test $status -eq 0 # Found '--' separator
|
||||||
|
# Extract packages before '--'
|
||||||
|
if test $sep_index -gt 1
|
||||||
|
set pkgs $all_args[1..(math $sep_index - 1)]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Extract and escape command after '--'
|
||||||
|
if test $sep_index -lt (count $all_args)
|
||||||
|
set -l raw_cmd $all_args[(math $sep_index + 1)..-1]
|
||||||
|
set -l escaped_cmd
|
||||||
|
for arg in $raw_cmd
|
||||||
|
set escaped_cmd $escaped_cmd (string escape -- "$arg")
|
||||||
|
end
|
||||||
|
set cmd_str (string join ' ' -- $escaped_cmd)
|
||||||
|
else
|
||||||
|
echo "Error: no command specified after --" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
else # No '--' found
|
||||||
|
set pkgs $all_args
|
||||||
|
end
|
||||||
|
|
||||||
|
if test (count $pkgs) -eq 0
|
||||||
|
echo "Error: no packages specified" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
__yay_green "««« CREATING NIX SHELL »»»"
|
__yay_green "««« CREATING NIX SHELL »»»"
|
||||||
__yay_yellow "Loading packages: $argv"
|
__yay_yellow "Loading packages: $pkgs"
|
||||||
__yay_run "nix-shell -p $argv --command fish"
|
|
||||||
|
set -l pkg_str (string join ' ' -- $pkgs)
|
||||||
|
if test -n "$cmd_str"
|
||||||
|
__yay_yellow "Running: $cmd_str"
|
||||||
|
__yay_run "nix-shell -p $pkg_str --run \"$cmd_str\""
|
||||||
|
else
|
||||||
|
__yay_run "nix-shell -p $pkg_str --command fish"
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -1,16 +1,35 @@
|
||||||
function __yay_update
|
function __yay_update
|
||||||
set -l opts h/help 'p/path='
|
set -l opts h/help 'p/path=' 'i/input='
|
||||||
argparse $opts -- $argv; or return
|
argparse $opts -- $argv; or return
|
||||||
if set -q _flag_help
|
if set -q _flag_help
|
||||||
echo "Usage: yay update [OPTIONS]"
|
echo "Usage: yay update [OPTIONS] [INPUT]"
|
||||||
echo " -p, --path PATH Path to the Nix configuration (overrides FLAKE)"
|
echo " -p, --path PATH Path to the Nix configuration (overrides FLAKE)"
|
||||||
echo " -h, --help Show this help message"
|
echo " -i, --input INPUT Name of the specific input to update"
|
||||||
|
echo " -h, --help Show this help message"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
set flake_path (__yay_get_flake_path $_flag_path); or return
|
set flake_path (__yay_get_flake_path $_flag_path); or return
|
||||||
__yay_green "««« UPDATING FLAKE INPUTS »»»"
|
|
||||||
set orig (pwd)
|
# Check if a specific input was provided either as flag or positional arg
|
||||||
cd $flake_path
|
set -l input_name ""
|
||||||
__yay_run "nix flake update"
|
if test -n "$_flag_input"
|
||||||
cd $orig
|
set input_name $_flag_input
|
||||||
|
else if test (count $argv) -gt 0
|
||||||
|
set input_name $argv[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -n "$input_name"
|
||||||
|
__yay_green "««« UPDATING FLAKE INPUT: $input_name »»»"
|
||||||
|
set orig (pwd)
|
||||||
|
cd $flake_path
|
||||||
|
__yay_run "nix flake lock --update-input $input_name"
|
||||||
|
cd $orig
|
||||||
|
else
|
||||||
|
__yay_green "««« UPDATING FLAKE INPUTS »»»"
|
||||||
|
set orig (pwd)
|
||||||
|
cd $flake_path
|
||||||
|
__yay_run "nix flake update"
|
||||||
|
cd $orig
|
||||||
|
end
|
||||||
end
|
end
|
36
readme.md
36
readme.md
|
@ -52,7 +52,7 @@ Add to your flake.nix:
|
||||||
nix shell github:Tophc7/yay.nix
|
nix shell github:Tophc7/yay.nix
|
||||||
|
|
||||||
## run any yay command
|
## run any yay command
|
||||||
yay try fastfetch
|
yay try fastfetch -- fastfetch --config examples/24
|
||||||
yay garbage
|
yay garbage
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -75,20 +75,28 @@ Options:
|
||||||
|
|
||||||
### update
|
### update
|
||||||
|
|
||||||
Update flake inputs.
|
Update flake inputs. You can update all inputs or specify a single input to update.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yay update [OPTIONS]
|
yay update [OPTIONS] [INPUT]
|
||||||
```
|
```
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
- `-p, --path PATH`: Path to the Nix configuration (overrides FLAKE)
|
- `-p, --path PATH`: Path to the Nix configuration (overrides FLAKE)
|
||||||
|
- `-i, --input INPUT`: Name of the specific input to update (alternative to positional argument)
|
||||||
- `-h, --help`: Show help message
|
- `-h, --help`: Show help message
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```bash
|
||||||
|
# Update all inputs
|
||||||
|
yay update
|
||||||
|
|
||||||
TODO:
|
# Update only the 'nixpkgs' input
|
||||||
- update specific inputs
|
yay update nixpkgs
|
||||||
- autocomplete for those inputs
|
|
||||||
|
# Update 'nixpkgs' using the flag
|
||||||
|
yay update -i nixpkgs
|
||||||
|
```
|
||||||
|
|
||||||
### garbage
|
### garbage
|
||||||
|
|
||||||
|
@ -107,19 +115,23 @@ This command:
|
||||||
|
|
||||||
### try
|
### try
|
||||||
|
|
||||||
Create a shell with specified packages.
|
Create a temporary shell with specified packages. You can either drop into an interactive shell or run a command directly within the environment using `--`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yay try PACKAGE [PACKAGE...]
|
yay try PACKAGE [PACKAGE...] [-- COMMAND [ARGS...]]
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
Examples:
|
||||||
```bash
|
```bash
|
||||||
|
# Enter an interactive shell with fastfetch and cowsay available
|
||||||
yay try fastfetch cowsay
|
yay try fastfetch cowsay
|
||||||
```
|
|
||||||
|
|
||||||
TODO:
|
# Run 'fastfetch' directly using the packages in the temporary shell
|
||||||
- allow `--` to run command directly
|
yay try fastfetch -- fastfetch
|
||||||
|
|
||||||
|
# Run 'cowsay moo' directly using the cowsay package
|
||||||
|
yay try cowsay -- cowsay moo
|
||||||
|
```
|
||||||
|
|
||||||
### tar
|
### tar
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
######################
|
||||||
|
# UTILITY FUNCTIONS #
|
||||||
|
######################
|
||||||
|
|
||||||
# Fallback functions for older fish versions
|
# Fallback functions for older fish versions
|
||||||
function __fish_seen_subcommand_from_fallback
|
function __fish_seen_subcommand_from_fallback
|
||||||
set -l cmd (commandline -poc)
|
set -l cmd (commandline -poc)
|
||||||
|
@ -49,34 +53,38 @@ function __yay_is_token_n
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Complete the main command
|
######################
|
||||||
complete -c yay -f
|
# HELPER FUNCTIONS #
|
||||||
|
######################
|
||||||
|
|
||||||
# Complete the top-level subcommands
|
# Flake input handling
|
||||||
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a rebuild -d "Rebuild the NixOS configuration"
|
function __yay_list_flake_inputs
|
||||||
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a update -d "Update flake inputs"
|
set -l flake_path (__yay_get_flake_path $argv[1]); or return
|
||||||
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a garbage -d "Clean up the Nix store"
|
|
||||||
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a try -d "Create a shell with the specified package(s)"
|
|
||||||
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a tar -d "Create compressed tar archives"
|
|
||||||
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a untar -d "Extract tar archives"
|
|
||||||
|
|
||||||
# Options for 'rebuild'
|
if not test -f "$flake_path/flake.lock"
|
||||||
complete -c yay -n "__yay_seen_subcommand_from rebuild" -s p -l path -r -d "Path to the Nix configuration"
|
return 1
|
||||||
complete -c yay -n "__yay_seen_subcommand_from rebuild" -s H -l host -r -d "Hostname to build for"
|
end
|
||||||
complete -c yay -n "__yay_seen_subcommand_from rebuild" -s t -l trace -d "Enable trace output"
|
|
||||||
complete -c yay -n "__yay_seen_subcommand_from rebuild" -s h -l help -d "Show help message"
|
|
||||||
|
|
||||||
# Options for 'update'
|
# Extract input names from the flake.lock file using jq
|
||||||
complete -c yay -n "__yay_seen_subcommand_from update" -s p -l path -r -d "Path to the Nix configuration"
|
jq -r '.nodes.root.inputs | keys[]' "$flake_path/flake.lock" 2>/dev/null
|
||||||
complete -c yay -n "__yay_seen_subcommand_from update" -s h -l help -d "Show help message"
|
end
|
||||||
|
|
||||||
# Options for 'garbage'
|
function __yay_get_flake_inputs
|
||||||
complete -c yay -n "__yay_seen_subcommand_from garbage" -s h -l help -d "Show help message"
|
set -l cmd (commandline -poc)
|
||||||
|
set -l path ""
|
||||||
|
|
||||||
# Options for 'try'
|
# Check for --path or -p option
|
||||||
complete -c yay -n "__yay_seen_subcommand_from try" -s h -l help -d "Show help message"
|
for i in (seq 1 (count $cmd))
|
||||||
|
if test "$cmd[$i]" = "--path" -o "$cmd[$i]" = "-p"; and test (count $cmd) -ge (math $i + 1)
|
||||||
|
set path $cmd[(math $i + 1)]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Package suggestions for 'try'
|
__yay_list_flake_inputs $path
|
||||||
|
end
|
||||||
|
|
||||||
|
# Package listing with caching
|
||||||
function __yay_list_packages
|
function __yay_list_packages
|
||||||
# Use persistent cache file in /tmp (lasts until reboot)
|
# Use persistent cache file in /tmp (lasts until reboot)
|
||||||
set -l cache_file /tmp/yay_packages_cache
|
set -l cache_file /tmp/yay_packages_cache
|
||||||
|
@ -107,6 +115,85 @@ function __yay_list_packages
|
||||||
printf "%s\n" $cleaned_packages
|
printf "%s\n" $cleaned_packages
|
||||||
end
|
end
|
||||||
|
|
||||||
|
######################
|
||||||
|
# MAIN COMMAND #
|
||||||
|
######################
|
||||||
|
|
||||||
|
# Complete the main command
|
||||||
|
complete -c yay -f
|
||||||
|
|
||||||
|
# Complete the top-level subcommands
|
||||||
|
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a rebuild -d "Rebuild the NixOS configuration"
|
||||||
|
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a update -d "Update flake inputs"
|
||||||
|
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a garbage -d "Clean up the Nix store"
|
||||||
|
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a try -d "Create a shell with the specified package(s)"
|
||||||
|
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a tar -d "Create compressed tar archives"
|
||||||
|
complete -c yay -n "not __yay_seen_subcommand_from rebuild update garbage try tar untar" -a untar -d "Extract tar archives"
|
||||||
|
|
||||||
|
######################
|
||||||
|
# REBUILD SUBCOMMAND #
|
||||||
|
######################
|
||||||
|
|
||||||
|
# Options for 'rebuild'
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from rebuild" -s p -l path -r -d "Path to the Nix configuration"
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from rebuild" -s H -l host -r -d "Hostname to build for"
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from rebuild" -s t -l trace -d "Enable trace output"
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from rebuild" -s h -l help -d "Show help message"
|
||||||
|
|
||||||
|
######################
|
||||||
|
# UPDATE SUBCOMMAND #
|
||||||
|
######################
|
||||||
|
|
||||||
|
# Options for 'update'
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from update" -s p -l path -r -d "Path to the Nix configuration"
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from update" -s i -l input -r -a "(__yay_get_flake_inputs)" -d "Specific input to update"
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from update" -s h -l help -d "Show help message"
|
||||||
|
|
||||||
|
# Positional argument for update (input name)
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from update; and not __yay_seen_option -i --input -h --help; and test (count (commandline -poc)) -eq 2" -a "(__yay_get_flake_inputs)" -d "Input to update"
|
||||||
|
|
||||||
|
######################
|
||||||
|
# GARBAGE SUBCOMMAND #
|
||||||
|
######################
|
||||||
|
|
||||||
|
# Options for 'garbage'
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from garbage" -s h -l help -d "Show help message"
|
||||||
|
|
||||||
|
######################
|
||||||
|
# TRY SUBCOMMAND #
|
||||||
|
######################
|
||||||
|
|
||||||
|
# Options for 'try'
|
||||||
|
complete -c yay -n "__yay_seen_subcommand_from try" -s h -l help -d "Show help message"
|
||||||
|
|
||||||
|
# Package completion for try (before --)
|
||||||
|
function __yay_try_no_dash_dash_yet
|
||||||
|
__yay_seen_subcommand_from try
|
||||||
|
and not contains -- -- (commandline -poc)
|
||||||
|
and not string match -r -- '^-' (commandline -ct)
|
||||||
|
end
|
||||||
|
complete -c yay -n "__yay_try_no_dash_dash_yet" -a "(__yay_list_packages)" -d "Nix package"
|
||||||
|
|
||||||
|
# Double dash separator completion for try
|
||||||
|
function __yay_try_can_add_dash_dash
|
||||||
|
__yay_seen_subcommand_from try
|
||||||
|
and not contains -- -- (commandline -poc)
|
||||||
|
and test (count (commandline -poc)) -gt 2
|
||||||
|
end
|
||||||
|
complete -c yay -n "__yay_try_can_add_dash_dash" -a "--" -d "Separator for command to run"
|
||||||
|
|
||||||
|
# Command completion after --
|
||||||
|
function __yay_try_after_dash_dash
|
||||||
|
set -l tokens (commandline -poc)
|
||||||
|
contains -- -- $tokens
|
||||||
|
and __yay_seen_subcommand_from try
|
||||||
|
end
|
||||||
|
complete -c yay -n "__yay_try_after_dash_dash" -a "(__fish_complete_command)" -d "Command to run"
|
||||||
|
|
||||||
|
######################
|
||||||
|
# TAR SUBCOMMAND #
|
||||||
|
######################
|
||||||
|
|
||||||
# Options for 'tar'
|
# Options for 'tar'
|
||||||
complete -c yay -n "__yay_seen_subcommand_from tar" -s o -l output -r -d "Output file path"
|
complete -c yay -n "__yay_seen_subcommand_from tar" -s o -l output -r -d "Output file path"
|
||||||
complete -c yay -n "__yay_seen_subcommand_from tar" -s c -l compression -r -a "zstd gzip bzip2 bzip3 7zip tar" -d "Compression type"
|
complete -c yay -n "__yay_seen_subcommand_from tar" -s c -l compression -r -a "zstd gzip bzip2 bzip3 7zip tar" -d "Compression type"
|
||||||
|
@ -115,7 +202,7 @@ complete -c yay -n "__yay_seen_subcommand_from tar" -s t -l threads -r -d "Threa
|
||||||
complete -c yay -n "__yay_seen_subcommand_from tar" -s v -l verbose -d "Enable verbose output"
|
complete -c yay -n "__yay_seen_subcommand_from tar" -s v -l verbose -d "Enable verbose output"
|
||||||
complete -c yay -n "__yay_seen_subcommand_from tar" -s h -l help -d "Show help message"
|
complete -c yay -n "__yay_seen_subcommand_from tar" -s h -l help -d "Show help message"
|
||||||
|
|
||||||
# File path completion for tar input (simplified)
|
# File path completion for tar input
|
||||||
function __yay_tar_needs_input
|
function __yay_tar_needs_input
|
||||||
__yay_seen_subcommand_from tar
|
__yay_seen_subcommand_from tar
|
||||||
and count (commandline -poc) = 2
|
and count (commandline -poc) = 2
|
||||||
|
@ -123,7 +210,7 @@ function __yay_tar_needs_input
|
||||||
end
|
end
|
||||||
complete -c yay -n __yay_tar_needs_input -r -d "Input path"
|
complete -c yay -n __yay_tar_needs_input -r -d "Input path"
|
||||||
|
|
||||||
# File path completion for tar output (simplified)
|
# File path completion for tar output
|
||||||
function __yay_tar_needs_output
|
function __yay_tar_needs_output
|
||||||
__yay_seen_subcommand_from tar
|
__yay_seen_subcommand_from tar
|
||||||
and count (commandline -poc) = 3
|
and count (commandline -poc) = 3
|
||||||
|
@ -131,12 +218,16 @@ function __yay_tar_needs_output
|
||||||
end
|
end
|
||||||
complete -c yay -n __yay_tar_needs_output -r -d "Output file"
|
complete -c yay -n __yay_tar_needs_output -r -d "Output file"
|
||||||
|
|
||||||
|
######################
|
||||||
|
# UNTAR SUBCOMMAND #
|
||||||
|
######################
|
||||||
|
|
||||||
# Options for 'untar'
|
# Options for 'untar'
|
||||||
complete -c yay -n "__yay_seen_subcommand_from untar" -s o -l output -r -d "Output directory"
|
complete -c yay -n "__yay_seen_subcommand_from untar" -s o -l output -r -d "Output directory"
|
||||||
complete -c yay -n "__yay_seen_subcommand_from untar" -s v -l verbose -d "Enable verbose output"
|
complete -c yay -n "__yay_seen_subcommand_from untar" -s v -l verbose -d "Enable verbose output"
|
||||||
complete -c yay -n "__yay_seen_subcommand_from untar" -s h -l help -d "Show help message"
|
complete -c yay -n "__yay_seen_subcommand_from untar" -s h -l help -d "Show help message"
|
||||||
|
|
||||||
# File path completion for untar with archive extensions (simplified)
|
# File path completion for untar input with archive extensions
|
||||||
function __yay_untar_needs_input
|
function __yay_untar_needs_input
|
||||||
__yay_seen_subcommand_from untar
|
__yay_seen_subcommand_from untar
|
||||||
and count (commandline -poc) = 2
|
and count (commandline -poc) = 2
|
||||||
|
@ -144,13 +235,10 @@ function __yay_untar_needs_input
|
||||||
end
|
end
|
||||||
complete -c yay -n __yay_untar_needs_input -r -a "*.tar *.tar.gz *.tgz *.tar.zst *.tzst *.tar.bz2 *.tbz *.tbz2 *.tb2 *.tz2 *.tar.bz3 *.7z *.tar.7z *.rar" -d "Archive file"
|
complete -c yay -n __yay_untar_needs_input -r -a "*.tar *.tar.gz *.tgz *.tar.zst *.tzst *.tar.bz2 *.tbz *.tbz2 *.tb2 *.tz2 *.tar.bz3 *.7z *.tar.7z *.rar" -d "Archive file"
|
||||||
|
|
||||||
# Directory completion for untar output directory (simplified)
|
# Directory completion for untar output directory
|
||||||
function __yay_untar_needs_output
|
function __yay_untar_needs_output
|
||||||
__yay_seen_subcommand_from untar
|
__yay_seen_subcommand_from untar
|
||||||
and count (commandline -poc) = 3
|
and count (commandline -poc) = 3
|
||||||
and not __yay_seen_option -o --output
|
and not __yay_seen_option -o --output
|
||||||
end
|
end
|
||||||
complete -c yay -n __yay_untar_needs_output -r -a "(__fish_complete_directories)" -d "Output directory"
|
complete -c yay -n __yay_untar_needs_output -r -a "(__fish_complete_directories)" -d "Output directory"
|
||||||
|
|
||||||
# Package completion for try
|
|
||||||
complete -c yay -n "__yay_seen_subcommand_from try; and not string match -r -- '^-' (commandline -ct)" -a "(__yay_list_packages)" -d "Nix package"
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue