mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-09 22:36:14 +01:00
Merge pull request #767 from Vogtinator/completion
Completion usability improvements
This commit is contained in:
commit
81d221242b
30
dist/osc.complete
vendored
30
dist/osc.complete
vendored
@ -26,6 +26,9 @@ typeset -i remove
|
||||
typeset -i colon
|
||||
typeset -r OIFS="$IFS"
|
||||
|
||||
# Do not pollute the terminal session with warnings or errors
|
||||
exec 2>/dev/null
|
||||
|
||||
if test "/proc/$PPID/exe" -ef /bin/tcsh ; then
|
||||
export COMP_TYPE=63
|
||||
export COMP_KEY=9
|
||||
@ -132,18 +135,21 @@ if test -n "$alias" ; then
|
||||
command="$command -A $alias"
|
||||
fi
|
||||
|
||||
if test -s "${projects}" ; then
|
||||
typeset -i ctime=$(command date -d "$(command stat -c '%z' ${projects})" +'%s')
|
||||
typeset -i now=$(command date -d now +'%s')
|
||||
if ((now - ctime > 86400)) ; then
|
||||
if tmp=$(mktemp ${projects}.XXXXXX) ; then
|
||||
command ${command} ls / >| $tmp
|
||||
mv -uf $tmp ${projects}
|
||||
fi
|
||||
update_projects_list ()
|
||||
{
|
||||
if test -s "${projects}" ; then
|
||||
typeset -i ctime=$(command date -d "$(command stat -c '%z' ${projects})" +'%s')
|
||||
typeset -i now=$(command date -d now +'%s')
|
||||
if ((now - ctime > 86400)) ; then
|
||||
if tmp=$(mktemp ${projects}.XXXXXX) ; then
|
||||
command ${command} ls / >| $tmp
|
||||
mv -uf $tmp ${projects}
|
||||
fi
|
||||
fi
|
||||
else
|
||||
command ${command} ls / >| "${projects}"
|
||||
fi
|
||||
else
|
||||
command ${command} ls / >| "${projects}"
|
||||
fi
|
||||
}
|
||||
|
||||
projects ()
|
||||
{
|
||||
@ -159,6 +165,7 @@ projects ()
|
||||
argv[argc++]=$arg
|
||||
done
|
||||
shift $argc
|
||||
update_projects_list
|
||||
cur="$1"
|
||||
if ((colon)) ; then
|
||||
local colon_word
|
||||
@ -272,6 +279,7 @@ targets ()
|
||||
|
||||
users ()
|
||||
{
|
||||
update_projects_list
|
||||
if test -s ${projects} ; then
|
||||
command sed -rn "/^home:$1/{ s/^home:([^:]*):.*/\1/p}" ${projects}|command sort -u
|
||||
elif test -s ~/.oscrc; then
|
||||
|
Loading…
Reference in New Issue
Block a user