Compare commits
10 Commits
d5805041f5
...
fa5e97fbe7
| Author | SHA1 | Date | |
|---|---|---|---|
| fa5e97fbe7 | |||
| 527ea74b48 | |||
| 67e7e7953b | |||
| 429681c26f | |||
| 0661280db5 | |||
| b70bd9ad17 | |||
| 0d0e0b9262 | |||
| f74937c683 | |||
| 5214472316 | |||
| 7744b3bda9 |
10
bin/idmgr
10
bin/idmgr
@ -151,7 +151,9 @@ idm_core__shell ()
|
|||||||
|
|
||||||
echo "export IDM_BIN=${IDM_BIN:-$IDM_DIR_ROOT/bin/idmgr}"
|
echo "export IDM_BIN=${IDM_BIN:-$IDM_DIR_ROOT/bin/idmgr}"
|
||||||
echo "export IDM_DIR_ROOT='$IDM_DIR_ROOT'"
|
echo "export IDM_DIR_ROOT='$IDM_DIR_ROOT'"
|
||||||
echo "IDM_SRC_WORDS='$IDM_SRC_WORDS $(lib_id_get_all_id | xargs)'"
|
#echo "IDM_SRC_WORDS='$IDM_SRC_WORDS $(lib_id_get_all_id | xargs)'"
|
||||||
|
echo "IDM_SRC_WORDS='$IDM_SRC_WORDS'"
|
||||||
|
echo "IDM_DIR_ID='$IDM_DIR_ID'"
|
||||||
|
|
||||||
tail -n +2 $IDM_DIR_ROOT/shell/bash.sh
|
tail -n +2 $IDM_DIR_ROOT/shell/bash.sh
|
||||||
}
|
}
|
||||||
@ -238,6 +240,7 @@ idm_mod_order ()
|
|||||||
IDM_MOD_DEPS="$( tr ' ' '\n' <<<${IDM_MOD_DEPS} )"
|
IDM_MOD_DEPS="$( tr ' ' '\n' <<<${IDM_MOD_DEPS} )"
|
||||||
|
|
||||||
# Output
|
# Output
|
||||||
|
# TOCHECK? echo -e "$( xargs -I{} echo {} "$mod_name" <<<"$IDM_MOD_DEPS" )"
|
||||||
echo -e "$( xargs -n1 -I{} echo {} "$mod_name" <<<"$IDM_MOD_DEPS" )"
|
echo -e "$( xargs -n1 -I{} echo {} "$mod_name" <<<"$IDM_MOD_DEPS" )"
|
||||||
done | tsort | grep -v 'core' | xargs
|
done | tsort | grep -v 'core' | xargs
|
||||||
#)
|
#)
|
||||||
@ -517,6 +520,8 @@ idm_core_init ()
|
|||||||
idm_lib_order_set gpg 11 89 11
|
idm_lib_order_set gpg 11 89 11
|
||||||
#idm_lib_order_set git 50 50 50
|
#idm_lib_order_set git 50 50 50
|
||||||
#idm_lib_order_set tomb 50 50 50
|
#idm_lib_order_set tomb 50 50 50
|
||||||
|
idm_lib_order_set gh 50 50 50
|
||||||
|
idm_lib_order_set gitea 50 50 50
|
||||||
|
|
||||||
# Load external lib
|
# Load external lib
|
||||||
idm_lib_load lib
|
idm_lib_load lib
|
||||||
@ -616,6 +621,9 @@ idm_core_cli ()
|
|||||||
if [[ -f "$IDM_ID_ENV" ]]; then
|
if [[ -f "$IDM_ID_ENV" ]]; then
|
||||||
. "$IDM_ID_ENV"
|
. "$IDM_ID_ENV"
|
||||||
fi
|
fi
|
||||||
|
if [[ -f "$IDM_DIR_ID/$id.secrets" ]]; then
|
||||||
|
. "$IDM_DIR_ID/$id.secrets"
|
||||||
|
fi
|
||||||
|
|
||||||
# Dispatch
|
# Dispatch
|
||||||
#lib_log DEBUG "menu=$menu action=${action:-_} id=$id opt=$opt"
|
#lib_log DEBUG "menu=$menu action=${action:-_} id=$id opt=$opt"
|
||||||
|
|||||||
43
docs/config.md
Normal file
43
docs/config.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
|
||||||
|
## Environment vars
|
||||||
|
|
||||||
|
|
||||||
|
* `IDM_DEBUG`:
|
||||||
|
* Type: Bool
|
||||||
|
* Desc: Set true for shell debugging
|
||||||
|
|
||||||
|
### Core Config
|
||||||
|
|
||||||
|
* `IDM_BIN`:
|
||||||
|
* Type: String/Path
|
||||||
|
* desc: Path of the idmgr executable script
|
||||||
|
* `IDM_DIR_ROOT`:
|
||||||
|
* Type: String/Path
|
||||||
|
* desc: Path of the idmgr code/library path
|
||||||
|
|
||||||
|
* `IDM_NO_BG`:
|
||||||
|
* Type: Bool
|
||||||
|
* Default: false
|
||||||
|
* Desc: Disable background service start
|
||||||
|
* Note: Will not start ssh-agent or other services ...
|
||||||
|
|
||||||
|
* `IDM_DISABLE_AUTO`:
|
||||||
|
* Default: ''
|
||||||
|
* Type: Words
|
||||||
|
* Desc: Disable some module components
|
||||||
|
* Example:
|
||||||
|
* `IDM_DISABLE_AUTO+=" git__enable git__disable git__kill "`
|
||||||
|
* `IDM_DISABLE_AUTO+="ps1__ls"`
|
||||||
|
|
||||||
|
### Id
|
||||||
|
|
||||||
|
* `IDM_LAST_ID_SAVE`:
|
||||||
|
* Type: Bool
|
||||||
|
* Default: true
|
||||||
|
* desc: Should the last loaded ID saved
|
||||||
|
|
||||||
|
* `IDM_LAST_ID_AUTOLOAD`:
|
||||||
|
* Type: Bool
|
||||||
|
* Default: true
|
||||||
|
* desc: Should the last saved ID should be enabled at shell startup
|
||||||
@ -200,6 +200,7 @@ lib_id_get_all_config ()
|
|||||||
|
|
||||||
lib_id_get_all_id ()
|
lib_id_get_all_id ()
|
||||||
{
|
{
|
||||||
|
local id=
|
||||||
for id in $( find $IDM_DIR_ID -type f -name '*.env' 2>/dev/null ); do
|
for id in $( find $IDM_DIR_ID -type f -name '*.env' 2>/dev/null ); do
|
||||||
id=${id%%\.env}
|
id=${id%%\.env}
|
||||||
echo "${id##*/}"
|
echo "${id##*/}"
|
||||||
|
|||||||
55
lib/idmgr_mod_gh.sh
Normal file
55
lib/idmgr_mod_gh.sh
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#IDM_MOD_PS1_DEPS="s4 id pass gpg ssh"
|
||||||
|
#IDM_DISABLE_AUTO+="gh__ls"
|
||||||
|
|
||||||
|
## Prompt functions
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
#SHELL_PS1="${SHELL_PS1:-${PS1}"
|
||||||
|
|
||||||
|
idm_gh ()
|
||||||
|
{
|
||||||
|
local action=${1-}
|
||||||
|
shift || true
|
||||||
|
|
||||||
|
idm_gh__ls
|
||||||
|
}
|
||||||
|
|
||||||
|
idm_gh__ls ()
|
||||||
|
{
|
||||||
|
local id=${1}
|
||||||
|
|
||||||
|
if [[ -n "${GH_TOKEN-}" ]] ; then
|
||||||
|
echo " enabled (repo: ${GH_REPO})"
|
||||||
|
else
|
||||||
|
echo " disabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
idm_gh__help ()
|
||||||
|
{
|
||||||
|
echo "Github CLI"
|
||||||
|
printf " %-20s: %s\n" "gh enable" "Enable gh token"
|
||||||
|
printf " %-20s: %s\n" "gh disable" "Disable gh token"
|
||||||
|
}
|
||||||
|
|
||||||
|
idm_gh__enable ()
|
||||||
|
{
|
||||||
|
|
||||||
|
if [[ -n "${gh_token-}" ]] ; then
|
||||||
|
echo "export GH_TOKEN=\"$gh_token\""
|
||||||
|
echo "export GH_REPO=\"$gh_repo\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
idm_gh__disable ()
|
||||||
|
{
|
||||||
|
echo "unset GH_TOKEN"
|
||||||
|
echo "unset GH_REPO"
|
||||||
|
}
|
||||||
|
|
||||||
|
idm_gh__kill () { idm_gh__disable ${@-}; }
|
||||||
78
lib/idmgr_mod_gitea.sh
Normal file
78
lib/idmgr_mod_gitea.sh
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#IDM_MOD_PS1_DEPS="s4 id pass gpg ssh"
|
||||||
|
#IDM_DISABLE_AUTO+="gitea__ls"
|
||||||
|
|
||||||
|
## Prompt functions
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
#SHELL_PS1="${SHELL_PS1:-${PS1}"
|
||||||
|
|
||||||
|
idm_gitea ()
|
||||||
|
{
|
||||||
|
local action=${1-}
|
||||||
|
shift || true
|
||||||
|
|
||||||
|
idm_gitea__ls
|
||||||
|
}
|
||||||
|
|
||||||
|
idm_gitea__ls ()
|
||||||
|
{
|
||||||
|
local id=${1}
|
||||||
|
|
||||||
|
if [[ -n "${GITEA_LOGIN-}" ]] ; then
|
||||||
|
echo " enabled (repo: ${GITEA_LOGIN} ${GITEA_URL})"
|
||||||
|
else
|
||||||
|
echo " disabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
idm_gitea__help ()
|
||||||
|
{
|
||||||
|
echo "Github CLI"
|
||||||
|
printf " %-20s: %s\n" "gitea enable" "Enable gitea token"
|
||||||
|
printf " %-20s: %s\n" "gitea disable" "Disable gitea token"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
idm_gitea__register ()
|
||||||
|
{
|
||||||
|
local gitea_url=$1
|
||||||
|
local gitea_login=$2
|
||||||
|
local gitea_token=$3
|
||||||
|
|
||||||
|
if tea login list -o simple | grep -q "^$gitea_login"; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
tea login add \
|
||||||
|
--url "$gitea_url" \
|
||||||
|
--name "$gitea_login" \
|
||||||
|
--token "$gitea_token" > /dev/null
|
||||||
|
>&2 echo "Tea login installed: $gitea_login ($gitea_url)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
idm_gitea__enable ()
|
||||||
|
{
|
||||||
|
|
||||||
|
[[ -n "${gitea_url-}" ]] || return 0
|
||||||
|
[[ -n "${gitea_login-}" ]] || return 0
|
||||||
|
[[ -n "${gitea_token-}" ]] || return 0
|
||||||
|
|
||||||
|
idm_gitea__register $gitea_url $gitea_login $gitea_token
|
||||||
|
|
||||||
|
echo "export GITEA_SERVER_URL=\"$gitea_token\""
|
||||||
|
echo "export GITEA_LOGIN=\"$gitea_login\""
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
idm_gitea__disable ()
|
||||||
|
{
|
||||||
|
echo "unset GITEA_SERVER_URL"
|
||||||
|
echo "unset GITEA_LOGIN"
|
||||||
|
}
|
||||||
|
|
||||||
|
idm_gitea__kill () { idm_gitea__disable ${@-}; }
|
||||||
@ -80,6 +80,7 @@ idm_gpg__enable ()
|
|||||||
|
|
||||||
local id=${1}
|
local id=${1}
|
||||||
lib_id_has_config $id
|
lib_id_has_config $id
|
||||||
|
idm_gpg_header $id
|
||||||
|
|
||||||
# Source environment
|
# Source environment
|
||||||
if [ -f "${XDG_RUNTIME_DIR}/pgp-agent/${id}/env" ]; then
|
if [ -f "${XDG_RUNTIME_DIR}/pgp-agent/${id}/env" ]; then
|
||||||
@ -88,15 +89,20 @@ idm_gpg__enable ()
|
|||||||
unset GPG_AGENT_INFO
|
unset GPG_AGENT_INFO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if socket is present
|
if [[ "${IDM_NO_BG:-false}" == true ]] || [[ -n "${DIRENV_IN_ENVRC-}" ]] ; then
|
||||||
if [ ! -S "${GPG_AGENT_INFO-}" ]; then
|
lib_log WARN "Start of gpg-agent background process disabled because of: IDM_NO_BG=${IDM_NO_BG-} or DIRENV_IN_ENVRC=${DIRENV_IN_ENVRC-}"
|
||||||
rm -f "${XDG_RUNTIME_DIR}/pgp-agent/${id}/env"
|
else
|
||||||
idm_gpg_start $id
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Show config to source
|
# Check if socket is present
|
||||||
if [ -f "${XDG_RUNTIME_DIR}/pgp-agent/${id}/env" ]; then
|
if [ ! -S "${GPG_AGENT_INFO-}" ]; then
|
||||||
cat "${XDG_RUNTIME_DIR}/pgp-agent/${id}/env"
|
rm -f "${XDG_RUNTIME_DIR}/pgp-agent/${id}/env"
|
||||||
|
idm_gpg_start $id
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show config to source
|
||||||
|
if [ -f "${XDG_RUNTIME_DIR}/pgp-agent/${id}/env" ]; then
|
||||||
|
cat "${XDG_RUNTIME_DIR}/pgp-agent/${id}/env"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Export tty to the current shell
|
# Export tty to the current shell
|
||||||
|
|||||||
@ -326,7 +326,7 @@ background() {
|
|||||||
idm_ssh__agent_start() {
|
idm_ssh__agent_start() {
|
||||||
# local socket=$1
|
# local socket=$1
|
||||||
local id=$1
|
local id=$1
|
||||||
local life=5d
|
local life=4w
|
||||||
|
|
||||||
local socket_dir="${XDG_RUNTIME_DIR}/ssh-agent/${id}"
|
local socket_dir="${XDG_RUNTIME_DIR}/ssh-agent/${id}"
|
||||||
local socket="${socket_dir}/socket"
|
local socket="${socket_dir}/socket"
|
||||||
|
|||||||
171
shell/bash.sh
171
shell/bash.sh
@ -6,20 +6,29 @@ IDM_BIN=${IDM_BIN:-idmgr}
|
|||||||
|
|
||||||
i ()
|
i ()
|
||||||
{
|
{
|
||||||
|
local IDM_SRC_IDS=$($IDM_BIN id names)
|
||||||
|
local result=
|
||||||
|
local idents=$()
|
||||||
|
local id=
|
||||||
|
for id in $( find $IDM_DIR_ID -type f -name '*.env' 2>/dev/null ); do
|
||||||
|
id=${id##*/}
|
||||||
|
idents="${idents:+$idents }${id%%\.env}"
|
||||||
|
done
|
||||||
|
|
||||||
if grep -q " ${1:-NONE} " <<<" ${IDM_SRC_WORDS} "; then
|
local patterns=" ${IDM_SRC_WORDS} ${IDM_SRC_IDS} $idents"
|
||||||
|
if grep -q " ${1:-NONE} " <<<" $patterns "; then
|
||||||
|
|
||||||
result="$( $IDM_BIN $@)"
|
result="$( $IDM_BIN $@)"
|
||||||
|
|
||||||
# Debug module
|
# Debug module
|
||||||
if [ "${ID_DEBUG-}" == "true" ]; then
|
if [ "${IDM_DEBUG-}" == "true" ]; then
|
||||||
echo "DEBUG: Command: $IDM_BIN $@"
|
>&2 echo "DEBUG: Source: $IDM_BIN $@"
|
||||||
if [ "${result:-NONE}" == "NONE" ]; then
|
if [ "${result:-NONE}" == "NONE" ]; then
|
||||||
echo "DEBUG: ======= ${result:-NONE}"
|
>&2 echo "DEBUG: ======= ${result:-NONE}"
|
||||||
else
|
else
|
||||||
echo "DEBUG: ======= Shell has sourced ======="
|
>&2 echo "DEBUG: ======= Shell has sourced ======="
|
||||||
echo "${result:-NONE}"
|
echo "${result:-NONE}"
|
||||||
echo "DEBUG: ======="
|
>&2 echo "DEBUG: ======="
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -27,6 +36,10 @@ i ()
|
|||||||
eval "$result"
|
eval "$result"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
if [ "${IDM_DEBUG-}" == "true" ]; then
|
||||||
|
>&2 echo "DEBUG: Command: $IDM_BIN $@"
|
||||||
|
>&2 echo "DEBUG: ======="
|
||||||
|
fi
|
||||||
$IDM_BIN $@
|
$IDM_BIN $@
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -35,6 +48,16 @@ i ()
|
|||||||
|
|
||||||
i_restore_last_id ()
|
i_restore_last_id ()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[[ "$IDM_LAST_ID_AUTOLOAD" == 'true' ]] || return 0
|
||||||
|
|
||||||
|
# Restore from SHELL_ID
|
||||||
|
if [[ -n "${SHELL_ID:-}" ]]; then
|
||||||
|
i enable $SHELL_ID
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Restore from last loaded shell
|
||||||
local IDM_DIR_CACHE=${IDM_DIR_CACHE:-${XDG_CACHE_HOME:-~/.cache}/idmgr}
|
local IDM_DIR_CACHE=${IDM_DIR_CACHE:-${XDG_CACHE_HOME:-~/.cache}/idmgr}
|
||||||
local state_file=$IDM_DIR_CACHE/last_id
|
local state_file=$IDM_DIR_CACHE/last_id
|
||||||
if [ -f "$state_file" ]; then
|
if [ -f "$state_file" ]; then
|
||||||
@ -45,7 +68,6 @@ i_restore_last_id ()
|
|||||||
i enable $id
|
i enable $id
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -54,138 +76,3 @@ bind -x '"\C-b": i disable'
|
|||||||
i_restore_last_id
|
i_restore_last_id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# completion file for bash
|
|
||||||
|
|
||||||
# Copyright (C) 2012 - 2014 Jason A. Donenfeld <Jason@zx2c4.com> and
|
|
||||||
# Brian Mattern <rephorm@rephorm.com>. All Rights Reserved.
|
|
||||||
# This file is licensed under the GPLv2+. Please see COPYING for more information.
|
|
||||||
|
|
||||||
_pass_complete_entries () {
|
|
||||||
prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
|
|
||||||
prefix="${prefix%/}/"
|
|
||||||
suffix=".gpg"
|
|
||||||
autoexpand=${1:-0}
|
|
||||||
|
|
||||||
local IFS=$'\n'
|
|
||||||
local items=($(compgen -f $prefix$cur))
|
|
||||||
|
|
||||||
# Remember the value of the first item, to see if it is a directory. If
|
|
||||||
# it is a directory, then don't add a space to the completion
|
|
||||||
local firstitem=""
|
|
||||||
# Use counter, can't use ${#items[@]} as we skip hidden directories
|
|
||||||
local i=0
|
|
||||||
|
|
||||||
for item in ${items[@]}; do
|
|
||||||
[[ $item =~ /\.[^/]*$ ]] && continue
|
|
||||||
|
|
||||||
# if there is a unique match, and it is a directory with one entry
|
|
||||||
# autocomplete the subentry as well (recursively)
|
|
||||||
if [[ ${#items[@]} -eq 1 && $autoexpand -eq 1 ]]; then
|
|
||||||
while [[ -d $item ]]; do
|
|
||||||
local subitems=($(compgen -f "$item/"))
|
|
||||||
local filtereditems=( )
|
|
||||||
for item2 in "${subitems[@]}"; do
|
|
||||||
[[ $item2 =~ /\.[^/]*$ ]] && continue
|
|
||||||
filtereditems+=( "$item2" )
|
|
||||||
done
|
|
||||||
if [[ ${#filtereditems[@]} -eq 1 ]]; then
|
|
||||||
item="${filtereditems[0]}"
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# append / to directories
|
|
||||||
[[ -d $item ]] && item="$item/"
|
|
||||||
|
|
||||||
item="${item%$suffix}"
|
|
||||||
COMPREPLY+=("${item#$prefix}")
|
|
||||||
if [[ $i -eq 0 ]]; then
|
|
||||||
firstitem=$item
|
|
||||||
fi
|
|
||||||
let i+=1
|
|
||||||
done
|
|
||||||
|
|
||||||
# The only time we want to add a space to the end is if there is only
|
|
||||||
# one match, and it is not a directory
|
|
||||||
if [[ $i -gt 1 || ( $i -eq 1 && -d $firstitem ) ]]; then
|
|
||||||
compopt -o nospace
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_pass_complete_folders () {
|
|
||||||
prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
|
|
||||||
prefix="${prefix%/}/"
|
|
||||||
|
|
||||||
local IFS=$'\n'
|
|
||||||
local items=($(compgen -d $prefix$cur))
|
|
||||||
for item in ${items[@]}; do
|
|
||||||
[[ $item == $prefix.* ]] && continue
|
|
||||||
COMPREPLY+=("${item#$prefix}/")
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
_pass_complete_keys () {
|
|
||||||
local IFS=$'\n'
|
|
||||||
# Extract names and email addresses from gpg --list-keys
|
|
||||||
local keys="$(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')"
|
|
||||||
COMPREPLY+=($(compgen -W "${keys}" -- ${cur}))
|
|
||||||
}
|
|
||||||
|
|
||||||
_pass()
|
|
||||||
{
|
|
||||||
COMPREPLY=()
|
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
local commands="init ls find grep show insert generate edit rm mv cp git help version"
|
|
||||||
if [[ $COMP_CWORD -gt 1 ]]; then
|
|
||||||
local lastarg="${COMP_WORDS[$COMP_CWORD-1]}"
|
|
||||||
case "${COMP_WORDS[1]}" in
|
|
||||||
init)
|
|
||||||
if [[ $lastarg == "-p" || $lastarg == "--path" ]]; then
|
|
||||||
_pass_complete_folders
|
|
||||||
compopt -o nospace
|
|
||||||
else
|
|
||||||
COMPREPLY+=($(compgen -W "-p --path" -- ${cur}))
|
|
||||||
_pass_complete_keys
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
ls|list|edit)
|
|
||||||
_pass_complete_entries
|
|
||||||
;;
|
|
||||||
show|-*)
|
|
||||||
COMPREPLY+=($(compgen -W "-c --clip" -- ${cur}))
|
|
||||||
_pass_complete_entries 1
|
|
||||||
;;
|
|
||||||
insert)
|
|
||||||
COMPREPLY+=($(compgen -W "-e --echo -m --multiline -f --force" -- ${cur}))
|
|
||||||
_pass_complete_entries
|
|
||||||
;;
|
|
||||||
generate)
|
|
||||||
COMPREPLY+=($(compgen -W "-n --no-symbols -c --clip -f --force -i --in-place" -- ${cur}))
|
|
||||||
_pass_complete_entries
|
|
||||||
;;
|
|
||||||
cp|copy|mv|rename)
|
|
||||||
COMPREPLY+=($(compgen -W "-f --force" -- ${cur}))
|
|
||||||
_pass_complete_entries
|
|
||||||
;;
|
|
||||||
rm|remove|delete)
|
|
||||||
COMPREPLY+=($(compgen -W "-r --recursive -f --force" -- ${cur}))
|
|
||||||
_pass_complete_entries
|
|
||||||
;;
|
|
||||||
git)
|
|
||||||
COMPREPLY+=($(compgen -W "init push pull config log reflog rebase" -- ${cur}))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
COMPREPLY+=($(compgen -W "${commands}" -- ${cur}))
|
|
||||||
_pass_complete_entries 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -o filenames -F _pass pass
|
|
||||||
|
|
||||||
# Show current identities
|
|
||||||
echo "INFO: idmgr has been loaded, use 'idmgr' or 'i' to call it"
|
|
||||||
#$IDM_BIN id ls
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user