mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-27 15:06:15 +01:00
Parse pwd's apiurl in zsh completion
Signed-off-by: Björn Bidar <bjorn.bidar@jolla.com>
This commit is contained in:
parent
b1d1069474
commit
09bfa0a9b5
@ -37,6 +37,18 @@ _osc() {
|
||||
osc_alias=internal
|
||||
fi
|
||||
|
||||
if [ -s "${PWD}/.osc/_apiurl" -a -s "${osc_rc}" ]; then
|
||||
local osc_apiurl
|
||||
read osc_apiurl < "${PWD}/.osc/_apiurl"
|
||||
# We prefer to match an apiurl with an alias so that the project list
|
||||
# cache would match also when -A was passed with said alias.
|
||||
# If there's no alias for that api url match to use the plain apiurl instead.
|
||||
osc_alias=$(sed -rn '\@^\['${apiurl}'@,\@=@{\@^aliases=@{s@[^=]+=([^,]+),.*@\1@p};}' < "${osc_rc}" 2> /dev/null)
|
||||
if [ -z $osc_alias ] ; then
|
||||
osc_alias=${osc_apiurl}
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( CURRENT > 2 )) && [[ ${words[2]} != "help" ]]; then
|
||||
# Remember the subcommand name
|
||||
local cmd=${words[2]}
|
||||
@ -74,8 +86,8 @@ _osc() {
|
||||
fi
|
||||
|
||||
if [[ -n "$osc_alias" ]] ; then
|
||||
osc_projects="${osc_projects}.${osc_alias}"
|
||||
osc_command="$osc_command -A $osc_alias"
|
||||
osc_projects="${osc_projects}.${osc_alias//\//_}"
|
||||
osc_command="$osc_command -A ${osc_alias}"
|
||||
fi
|
||||
|
||||
_osc_update_project_list
|
||||
|
Loading…
Reference in New Issue
Block a user