#compdef mutn libmuttonEntryRoot="$HOME/.local/share/libmutton" libmuttonFullPaths=("$libmuttonEntryRoot"/**/*) libmuttonTrimmedPaths=() for scanPath in "${libmuttonFullPaths[@]}"; do # exclude directories [ -f "$scanPath" ] && libmuttonTrimmedPaths+=("${scanPath#$libmuttonEntryRoot}") done [[ -z $libmuttonTrimmedPaths ]] && libmuttonTrimmedPaths=(help) case ${words[-2]} in mutn ) compadd $libmuttonTrimmedPaths ;; /* ) compadd {copy,edit,gen,add,shear} ;; add ) compadd {password,note,folder} ;; copy ) compadd {password,username,totp,url,note,menu} ;; edit ) compadd {password,username,totp,url,note,rename} ;; gen ) compadd update ;; esac