Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
83a66ac6
Commit
83a66ac6
authored
May 27, 2024
by
Иван Мажукин
Committed by
Vitaly Lipatov
Nov 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bash_completion/eepm: add base useful short commands from help (eterbug #17251)
parent
dd4d4731
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
166 additions
and
33 deletions
+166
-33
eepm
bash_completion/eepm
+166
-33
No files found.
bash_completion/eepm
View file @
83a66ac6
...
@@ -3,7 +3,31 @@
...
@@ -3,7 +3,31 @@
# This completes on a list of all available services for the
# This completes on a list of all available services for the
# 'serv' command, followed by that script's available commands
# 'serv' command, followed by that script's available commands
#
#
EEMP_COMMANDS="install|remove|play|update|full-upgrade|Upgrade|search|cl|qf|Install"
# packages complete commands
EEMP_COMMANDS="query|q|info|packages|filelist|qp|grep|query_package|ql|get-files|changelog|cl|qi|show|qa|list-installed|ls|li|list-available|programs"
# package requires and depend complete commands
EEMP_COMMANDS+="|requires|deplist|depends|req|depends-on|whatdepends|rdepends|whatrequires|wd|required-by|provides|prov|whatprovides|conflicts|policy|resolve"
# query package owning file complete commands
EEMP_COMMANDS+="|qf|wp|which|belongs"
# install complete commands
EEMP_COMMANDS+="|install|Install|reinstall|play|add|i|it|installed"
# remove complete commands
EEMP_COMMANDS+="|rm|del|remove|delete|uninstall|erase|purge|e"
# update complete commands
EEMP_COMMANDS+="|update|full-upgrade|Upgrade"
# search complete commands
EEMP_COMMANDS+="|search|search-file|s|find|sr|filesearch|sf"
# complex complete commands
EEMP_COMMANDS+="|status|list|assure"
# short args complete commands
EEPM_SHORT_ARGS='-h|-v|-y|-i|-e|-P|-s|-qp|-qf|-q|-S|-sf|-ql|-cl|-qi|-qa'
EEPM_FULL_ARGS='--help --version --verbose --debug
--skip-installed --skip-missed --show-command-only --quiet --silent --nodeps
--force --noremove --no-remove --no-stdin --inscript
--dry-run --simulate --just-print --no-act --short --direct --repack --norepack --install
--scripts --noscripts --save-only --put-to-repo= --download-only --url --sort --auto
--assumeyes --non-interactive --disable-interactivity --interactive --force-yes'
__eepm_list_commands()
__eepm_list_commands()
{
{
...
@@ -28,55 +52,114 @@ __eepm_list_available_packages_play()
...
@@ -28,55 +52,114 @@ __eepm_list_available_packages_play()
COMPREPLY=( $( epm play --list-all --quiet --short ) )
COMPREPLY=( $( epm play --list-all --quiet --short ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.sh}' -- "$cur" ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.sh}' -- "$cur" ) )
}
}
#TODO fix spaces in path
__eepm_complete_qf() {
__eepm_complete_qf() {
local cur=${COMP_WORDS[COMP_CWORD]}
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -o default -A file -A command -- "$cur") )
if [[ $cur == */* ]]; then
_filedir
else
COMPREPLY=( $(compgen -A command -- "$cur") )
fi
}
}
__eepm_complete_args(){
__eepm_complete_status() {
COMPREPLY=($(compgen -W '-h --help -v --version --verbose --debug
local cur=${COMP_WORDS[COMP_CWORD]}
--skip-installed --skip-missed --show-command-only --quiet --silent --nodeps
local options="--installed --installable --original --certified --thirdparty --repacked --validate"
--force --noremove --no-remove --no-stdin --inscript
--dry-run --simulate --just-print --no-act --short --direct --repack --norepack --install
if [[ $cur == --* || ($cur == '' && $prev == 'status') ]]; then
--scripts --noscripts --save-only --put-to-repo= --download-only --url --sort -y --auto
COMPREPLY=( $(compgen -W "$options" -- "$cur") )
--assumeyes --non-interactive --disable-interactivity --interactive --force-yes' -- "$cur"))
elif [[ ${COMP_CWORD} -eq 3 ]]; then
__eepm_list_available_packages
fi
}
}
__eepm_complete_list() {
local cur=${COMP_WORDS[COMP_CWORD]}
local options="--available --installed --upgradable"
if [[ $cur == --* || ($cur == '' && $prev == 'list') ]]; then
COMPREPLY=( $(compgen -W "$options" -- "$cur") )
# elif [[ ${COMP_CWORD} -eq 3 ]]; then
# __eepm_list_available_packages
fi
}
__eepm_complete_assure() {
local cur=${COMP_WORDS[COMP_CWORD]}
if [[ $cur == */* ]]; then
_filedir
else
COMPREPLY=( $(compgen -A command -- "$cur") )
fi
}
__eepm_complete_full_args(){
COMPREPLY=($(compgen -W "$EEPM_FULL_ARGS" -- "$cur"))
}
__eepm_complete_short_args(){
COMPREPLY=( $(echo ${EEPM_SHORT_ARGS//'|'/' '}) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
}
__eepm_complete_commands() {
__eepm_complete_commands() {
local special i
local special i
for ((i = 1; i < ${#COMP_WORDS[@]} - 1; i++)); do
for ((i = 1; i < ${#COMP_WORDS[@]} - 1; i++)); do
if [[ ${COMP_WORDS[i]} == @(${EEMP_COMMANDS}) ]]; then
if [[ ${COMP_WORDS[i]} == @(${EEMP_COMMANDS})
|| ${COMP_WORDS[i]} == @(${EEPM_SHORT_ARGS})
]]; then
special=${COMP_WORDS[i]}
special=${COMP_WORDS[i]}
break
break
fi
fi
done
done
if [[ -v special ]]; then
if [[ -v special ]]; then
case $special in
case $special in
install|cl|Install)
install|Install|reinstall|add|i|it|-i|installed)
__eepm_list_available_packages
return 0
;;
query|q|-q|info|qp|grep|query_package|-qp|changelog|cl|-cl|show|qi|-qi)
__eepm_list_available_packages
return 0
;;
search|s|find|sr|-s|-ql|ql|get-files|filelist)
__eepm_list_available_packages
__eepm_list_available_packages
return 0
return 0
;;
;;
remove)
requires|deplist|depends|req|depends-on|whatdepends|rdepends|whatrequires|wd|required-by|provides|prov|whatprovides|conflicts|policy|resolve)
__eepm_list_available_packages
return 0
;;
remove|rm|del|delete|uninstall|erase|purge|e|-e|-P)
__eepm_list_installed_packages
__eepm_list_installed_packages
return 0
return 0
;;
;;
play)
play)
__eepm_list_available_packages_play
__eepm_list_available_packages_play
return 0
return 0
;;
;;
qf)
qf
|wp|which|belongs|-qf|-S
)
__eepm_complete_qf
__eepm_complete_qf
return 0
return 0
;;
;;
status)
__eepm_complete_status
return 0
;;
list)
__eepm_complete_list
return 0
;;
assure)
__eepm_complete_assure
return 0
;;
*)
*)
return 0
return 0
;;
;;
esac
esac
else
else
__eepm_list_commands
__eepm_list_commands
fi
fi
...
@@ -90,28 +173,78 @@ __eepm()
...
@@ -90,28 +173,78 @@ __eepm()
COMPREPLY=()
COMPREPLY=()
_get_comp_words_by_ref cur prev
_get_comp_words_by_ref cur prev
case "${COMP_WORDS[0]}" in
cmd="${COMP_WORDS[1]}"
epm)
__eepm_complete_commands ;;
case "${COMP_WORDS[0]}" in
epmi|epmcl)
epm|eepm)
__eepm_list_available_packages ;;
__eepm_complete_commands
epme)
;;
__eepm_list_installed_packages ;;
epmi|epmcl|epmwd|epmq|epmqi|epmqp|epms|epmql)
epmp)
__eepm_list_available_packages
__eepm_list_available_packages_play ;;
return 0
epmqf)
;;
__eepm_complete_qf ;;
epme)
*)
__eepm_list_installed_packages
return 0 ;;
return 0
;;
epmp)
__eepm_list_available_packages_play
return 0
;;
epmqf)
__eepm_complete_qf
return 0
;;
*)
return 0
;;
esac
esac
if [[ $cur == --* && ! $cur = '-' ]]; then
case $cmd in
epm|eepm)
__eepm_complete_full_args
return 0
;;
status)
__eepm_complete_status
return 0
;;
list)
__eepm_complete_list
return 0
;;
*)
__eepm_complete_full_args
return 0
;;
esac
fi
if [[ $cur == -* ]]; then
if [[ $cur == -* ]]; then
__eepm_complete_args
case $cmd in
return 0
epm|eepm)
__eepm_complete_short_args
return 0
;;
status)
__eepm_complete_status
return 0
;;
list)
__eepm_complete_list
return 0
;;
*)
__eepm_complete_short_args
return 0
;;
esac
fi
fi
} &&
} &&
# . "/usr/share/bash-completion/bash_completion"
# . "/usr/share/bash-completion/bash_completion"
complete -F __eepm epm e
pmi epme epmp epmcl epmqf epmI
complete -F __eepm epm e
epm epmi epme epmp epmcl epmqf epmI epms epmsf epmwd epmq epmqi epmqa epmqp epmql epmrl epmu
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment