mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-07-26 11:52:04 +08:00
op: autocomplete (#38081)
* op autocomplete * rm * indent * Revert "indent" This reverts commit 6dd513f3229741864563f81ab8547c24c3557dda. * clean er
This commit is contained in:
+8
-2
@@ -21,8 +21,14 @@ if [ "$(uname)" == "Darwin" ] && [ $SHELL == "/bin/bash" ]; then
|
||||
fi
|
||||
function op_install() {
|
||||
echo "Installing op system-wide..."
|
||||
CMD="\nalias op='"$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )/op.sh" \"\$@\"'\n"
|
||||
grep "alias op=" "$RC_FILE" &> /dev/null || printf "$CMD" >> $RC_FILE
|
||||
OP_SH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )/op.sh"
|
||||
CMD=$(cat <<EOF
|
||||
alias op='$OP_SH "\$@"'
|
||||
_op_completions() { [ "\$COMP_CWORD" -eq 1 ] && COMPREPLY=(\$(compgen -W "\$(awk '/shift 1; op_/{print \$1}' $OP_SH)" -- "\${COMP_WORDS[1]}")); }
|
||||
complete -F _op_completions -o default op
|
||||
EOF
|
||||
)
|
||||
grep -q "alias op=" "$RC_FILE" 2>/dev/null || printf '\n%s\n' "$CMD" >> "$RC_FILE"
|
||||
echo -e " ↳ [${GREEN}✔${NC}] op installed successfully. Open a new shell to use it."
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user