mirror of
https://github.com/sbopkg/sbopkg
synced 2024-11-10 03:50:33 +03:00
Merge pull request #21 from sftp/bash-completion
bash-completion: complete -{i,b} when git (not rsync) used for repo
This commit is contained in:
commit
e0aad3b78f
@ -65,10 +65,20 @@ _sbopkg()
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ! -r "$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT" ]; then
|
if [ -d "$QUEUEDIR" ]; then
|
||||||
return 0
|
local queues=($(cd $QUEUEDIR; compgen -f -X "!*.sqf" -- "$cur"))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -r "$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT" ]; then
|
||||||
|
COMPREPLY=($(sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}" \
|
||||||
|
$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT)
|
||||||
|
${queues[@]})
|
||||||
|
elif [ -d "$REPO_ROOT/$REPO_NAME/" ]; then
|
||||||
|
COMPREPLY=($(find $REPO_ROOT/$REPO_NAME \
|
||||||
|
\! -path $REPO_ROOT/$REPO_NAME/'.git/*' \
|
||||||
|
-mindepth 2 -maxdepth 2 \
|
||||||
|
-type d -name $cur\* \
|
||||||
|
-printf '%f\n')
|
||||||
|
${queues[@]})
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( $( sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\
|
|
||||||
$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT )
|
|
||||||
$( cd $QUEUEDIR; compgen -f -X "!*.sqf" -- "$cur" ) )
|
|
||||||
} && complete -o filenames -F _sbopkg sbopkg
|
} && complete -o filenames -F _sbopkg sbopkg
|
||||||
|
Loading…
Reference in New Issue
Block a user