Last active
August 29, 2015 13:57
-
-
Save antonagestam/9923206 to your computer and use it in GitHub Desktop.
shcmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __shcmd_complete(){ | |
echo "COMPLETING WOHO!" | |
tput rc | |
tput ed | |
echo "COMPLETING WOHO!" | |
export READLINE_LINE="uh-huh" | |
} | |
function read_completion(){ | |
set -o emacs | |
base_prompt="($@) $ " | |
completion="" | |
tput sc | |
bind -x '"\t":"echo hello;__shcmd_complete"'; | |
read -ep "$base_prompt$completion" args | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ./shcmd-completion.sh | |
function shcmd(){ | |
while true; do | |
read -p "($@) $ " args | |
command="$@ $args" | |
$command | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: Command completion