Files
feddy/completions.zsh
Rawleenc 4cf779b3fe feat: add command-line interface and package management functionality
- Implemented a new CLI using Clap for managing Fedora configurations and packages.
- Added commands for configuring dnf, adding repositories, installing RPM Fusion, adding users to groups, and managing packages.
- Created data files for various package lists (AMD, Intel, common, firmware, gnome extra) and user groups.
- Introduced Zsh completion script for improved command-line usability.
- Removed the old CLI implementation and integrated the new structure into the main application logic.
2025-05-01 20:35:29 +02:00

604 lines
17 KiB
Bash

#compdef feddy
autoload -U is-at-least
_feddy() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" : \
'--generate=[]:GENERATOR:(bash elvish fish powershell zsh)' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_feddy_commands" \
"*::: :->feddy" \
&& ret=0
case $state in
(feddy)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:feddy-command-$line[1]:"
case $line[1] in
(configure-dnf)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(add-repo)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_feddy__add-repo_commands" \
"*::: :->add-repo" \
&& ret=0
case $state in
(add-repo)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:feddy-add-repo-command-$line[1]:"
case $line[1] in
(vscode)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(mullvad)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(vivaldi)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_feddy__add-repo__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:feddy-add-repo-help-command-$line[1]:"
case $line[1] in
(vscode)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(mullvad)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(vivaldi)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
;;
(install-rpm-fusion)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(add-user-to-groups)
_arguments "${_arguments_options[@]}" : \
'-u+[]:USER:_default' \
'--user=[]:USER:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(package)
_arguments "${_arguments_options[@]}" : \
'-r[]' \
'--remove[]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_feddy__package_commands" \
"*::: :->package" \
&& ret=0
case $state in
(package)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:feddy-package-command-$line[1]:"
case $line[1] in
(common-list)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(amd-list)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(intel-list)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(gnome-extra-list)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(firmware-list)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(custom-list)
_arguments "${_arguments_options[@]}" : \
'-f+[]:FILE:_default' \
'--file=[]:FILE:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_feddy__package__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:feddy-package-help-command-$line[1]:"
case $line[1] in
(common-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(amd-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(intel-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(gnome-extra-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(firmware-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(custom-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_feddy__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:feddy-help-command-$line[1]:"
case $line[1] in
(configure-dnf)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(add-repo)
_arguments "${_arguments_options[@]}" : \
":: :_feddy__help__add-repo_commands" \
"*::: :->add-repo" \
&& ret=0
case $state in
(add-repo)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:feddy-help-add-repo-command-$line[1]:"
case $line[1] in
(vscode)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(mullvad)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(vivaldi)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
esac
;;
esac
;;
(install-rpm-fusion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(add-user-to-groups)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(package)
_arguments "${_arguments_options[@]}" : \
":: :_feddy__help__package_commands" \
"*::: :->package" \
&& ret=0
case $state in
(package)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:feddy-help-package-command-$line[1]:"
case $line[1] in
(common-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(amd-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(intel-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(gnome-extra-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(firmware-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(custom-list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
esac
;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
}
(( $+functions[_feddy_commands] )) ||
_feddy_commands() {
local commands; commands=(
'configure-dnf:Configure dnf' \
'add-repo:Add a repository' \
'install-rpm-fusion:Install RPM fusion' \
'add-user-to-groups:Add user to groups' \
'package:Manage packages' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'feddy commands' commands "$@"
}
(( $+functions[_feddy__add-repo_commands] )) ||
_feddy__add-repo_commands() {
local commands; commands=(
'vscode:Add VSCode repository' \
'mullvad:Add Mullvad repository' \
'vivaldi:Add Vivaldi repository' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'feddy add-repo commands' commands "$@"
}
(( $+functions[_feddy__add-repo__help_commands] )) ||
_feddy__add-repo__help_commands() {
local commands; commands=(
'vscode:Add VSCode repository' \
'mullvad:Add Mullvad repository' \
'vivaldi:Add Vivaldi repository' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'feddy add-repo help commands' commands "$@"
}
(( $+functions[_feddy__add-repo__help__help_commands] )) ||
_feddy__add-repo__help__help_commands() {
local commands; commands=()
_describe -t commands 'feddy add-repo help help commands' commands "$@"
}
(( $+functions[_feddy__add-repo__help__mullvad_commands] )) ||
_feddy__add-repo__help__mullvad_commands() {
local commands; commands=()
_describe -t commands 'feddy add-repo help mullvad commands' commands "$@"
}
(( $+functions[_feddy__add-repo__help__vivaldi_commands] )) ||
_feddy__add-repo__help__vivaldi_commands() {
local commands; commands=()
_describe -t commands 'feddy add-repo help vivaldi commands' commands "$@"
}
(( $+functions[_feddy__add-repo__help__vscode_commands] )) ||
_feddy__add-repo__help__vscode_commands() {
local commands; commands=()
_describe -t commands 'feddy add-repo help vscode commands' commands "$@"
}
(( $+functions[_feddy__add-repo__mullvad_commands] )) ||
_feddy__add-repo__mullvad_commands() {
local commands; commands=()
_describe -t commands 'feddy add-repo mullvad commands' commands "$@"
}
(( $+functions[_feddy__add-repo__vivaldi_commands] )) ||
_feddy__add-repo__vivaldi_commands() {
local commands; commands=()
_describe -t commands 'feddy add-repo vivaldi commands' commands "$@"
}
(( $+functions[_feddy__add-repo__vscode_commands] )) ||
_feddy__add-repo__vscode_commands() {
local commands; commands=()
_describe -t commands 'feddy add-repo vscode commands' commands "$@"
}
(( $+functions[_feddy__add-user-to-groups_commands] )) ||
_feddy__add-user-to-groups_commands() {
local commands; commands=()
_describe -t commands 'feddy add-user-to-groups commands' commands "$@"
}
(( $+functions[_feddy__configure-dnf_commands] )) ||
_feddy__configure-dnf_commands() {
local commands; commands=()
_describe -t commands 'feddy configure-dnf commands' commands "$@"
}
(( $+functions[_feddy__help_commands] )) ||
_feddy__help_commands() {
local commands; commands=(
'configure-dnf:Configure dnf' \
'add-repo:Add a repository' \
'install-rpm-fusion:Install RPM fusion' \
'add-user-to-groups:Add user to groups' \
'package:Manage packages' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'feddy help commands' commands "$@"
}
(( $+functions[_feddy__help__add-repo_commands] )) ||
_feddy__help__add-repo_commands() {
local commands; commands=(
'vscode:Add VSCode repository' \
'mullvad:Add Mullvad repository' \
'vivaldi:Add Vivaldi repository' \
)
_describe -t commands 'feddy help add-repo commands' commands "$@"
}
(( $+functions[_feddy__help__add-repo__mullvad_commands] )) ||
_feddy__help__add-repo__mullvad_commands() {
local commands; commands=()
_describe -t commands 'feddy help add-repo mullvad commands' commands "$@"
}
(( $+functions[_feddy__help__add-repo__vivaldi_commands] )) ||
_feddy__help__add-repo__vivaldi_commands() {
local commands; commands=()
_describe -t commands 'feddy help add-repo vivaldi commands' commands "$@"
}
(( $+functions[_feddy__help__add-repo__vscode_commands] )) ||
_feddy__help__add-repo__vscode_commands() {
local commands; commands=()
_describe -t commands 'feddy help add-repo vscode commands' commands "$@"
}
(( $+functions[_feddy__help__add-user-to-groups_commands] )) ||
_feddy__help__add-user-to-groups_commands() {
local commands; commands=()
_describe -t commands 'feddy help add-user-to-groups commands' commands "$@"
}
(( $+functions[_feddy__help__configure-dnf_commands] )) ||
_feddy__help__configure-dnf_commands() {
local commands; commands=()
_describe -t commands 'feddy help configure-dnf commands' commands "$@"
}
(( $+functions[_feddy__help__help_commands] )) ||
_feddy__help__help_commands() {
local commands; commands=()
_describe -t commands 'feddy help help commands' commands "$@"
}
(( $+functions[_feddy__help__install-rpm-fusion_commands] )) ||
_feddy__help__install-rpm-fusion_commands() {
local commands; commands=()
_describe -t commands 'feddy help install-rpm-fusion commands' commands "$@"
}
(( $+functions[_feddy__help__package_commands] )) ||
_feddy__help__package_commands() {
local commands; commands=(
'common-list:Install/Remove the common list' \
'amd-list:Install/Remove the AMD list' \
'intel-list:Install/Remove the Intel list' \
'gnome-extra-list:Install/Remove the Gnome extra list' \
'firmware-list:Install/Remove the firmware list' \
'custom-list:Install/Remove a custom list' \
)
_describe -t commands 'feddy help package commands' commands "$@"
}
(( $+functions[_feddy__help__package__amd-list_commands] )) ||
_feddy__help__package__amd-list_commands() {
local commands; commands=()
_describe -t commands 'feddy help package amd-list commands' commands "$@"
}
(( $+functions[_feddy__help__package__common-list_commands] )) ||
_feddy__help__package__common-list_commands() {
local commands; commands=()
_describe -t commands 'feddy help package common-list commands' commands "$@"
}
(( $+functions[_feddy__help__package__custom-list_commands] )) ||
_feddy__help__package__custom-list_commands() {
local commands; commands=()
_describe -t commands 'feddy help package custom-list commands' commands "$@"
}
(( $+functions[_feddy__help__package__firmware-list_commands] )) ||
_feddy__help__package__firmware-list_commands() {
local commands; commands=()
_describe -t commands 'feddy help package firmware-list commands' commands "$@"
}
(( $+functions[_feddy__help__package__gnome-extra-list_commands] )) ||
_feddy__help__package__gnome-extra-list_commands() {
local commands; commands=()
_describe -t commands 'feddy help package gnome-extra-list commands' commands "$@"
}
(( $+functions[_feddy__help__package__intel-list_commands] )) ||
_feddy__help__package__intel-list_commands() {
local commands; commands=()
_describe -t commands 'feddy help package intel-list commands' commands "$@"
}
(( $+functions[_feddy__install-rpm-fusion_commands] )) ||
_feddy__install-rpm-fusion_commands() {
local commands; commands=()
_describe -t commands 'feddy install-rpm-fusion commands' commands "$@"
}
(( $+functions[_feddy__package_commands] )) ||
_feddy__package_commands() {
local commands; commands=(
'common-list:Install/Remove the common list' \
'amd-list:Install/Remove the AMD list' \
'intel-list:Install/Remove the Intel list' \
'gnome-extra-list:Install/Remove the Gnome extra list' \
'firmware-list:Install/Remove the firmware list' \
'custom-list:Install/Remove a custom list' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'feddy package commands' commands "$@"
}
(( $+functions[_feddy__package__amd-list_commands] )) ||
_feddy__package__amd-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package amd-list commands' commands "$@"
}
(( $+functions[_feddy__package__common-list_commands] )) ||
_feddy__package__common-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package common-list commands' commands "$@"
}
(( $+functions[_feddy__package__custom-list_commands] )) ||
_feddy__package__custom-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package custom-list commands' commands "$@"
}
(( $+functions[_feddy__package__firmware-list_commands] )) ||
_feddy__package__firmware-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package firmware-list commands' commands "$@"
}
(( $+functions[_feddy__package__gnome-extra-list_commands] )) ||
_feddy__package__gnome-extra-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package gnome-extra-list commands' commands "$@"
}
(( $+functions[_feddy__package__help_commands] )) ||
_feddy__package__help_commands() {
local commands; commands=(
'common-list:Install/Remove the common list' \
'amd-list:Install/Remove the AMD list' \
'intel-list:Install/Remove the Intel list' \
'gnome-extra-list:Install/Remove the Gnome extra list' \
'firmware-list:Install/Remove the firmware list' \
'custom-list:Install/Remove a custom list' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'feddy package help commands' commands "$@"
}
(( $+functions[_feddy__package__help__amd-list_commands] )) ||
_feddy__package__help__amd-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package help amd-list commands' commands "$@"
}
(( $+functions[_feddy__package__help__common-list_commands] )) ||
_feddy__package__help__common-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package help common-list commands' commands "$@"
}
(( $+functions[_feddy__package__help__custom-list_commands] )) ||
_feddy__package__help__custom-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package help custom-list commands' commands "$@"
}
(( $+functions[_feddy__package__help__firmware-list_commands] )) ||
_feddy__package__help__firmware-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package help firmware-list commands' commands "$@"
}
(( $+functions[_feddy__package__help__gnome-extra-list_commands] )) ||
_feddy__package__help__gnome-extra-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package help gnome-extra-list commands' commands "$@"
}
(( $+functions[_feddy__package__help__help_commands] )) ||
_feddy__package__help__help_commands() {
local commands; commands=()
_describe -t commands 'feddy package help help commands' commands "$@"
}
(( $+functions[_feddy__package__help__intel-list_commands] )) ||
_feddy__package__help__intel-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package help intel-list commands' commands "$@"
}
(( $+functions[_feddy__package__intel-list_commands] )) ||
_feddy__package__intel-list_commands() {
local commands; commands=()
_describe -t commands 'feddy package intel-list commands' commands "$@"
}
if [ "$funcstack[1]" = "_feddy" ]; then
_feddy "$@"
else
compdef _feddy feddy
fi