Skip to content

Commit a540351

Browse files
[Update] - update feature to put command to input command line
1 parent d69536c commit a540351

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

main.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,9 @@ if [[ "${LHS_BIND_KEY}" = "True" ]]; then
7777
# zle -N aws_help
7878
zle -N aws_main_function
7979
bindkey '^@' aws_main_function
80+
81+
zle -N aws_get_command
82+
# Hotkey: Option + a + c
83+
bindkey 'åç' aws_get_command
8084
# bindkey '^e' aws_help
8185
fi

services/help.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ aws_main_function() {
3131

3232
aws_get_command() {
3333
if [ ! -s ${aws_cli_input_folder}/aws_list_services.txt ]; then
34-
curl https://awscli.amazonaws.com/v2/documentation/api/latest/reference/index.html | grep '<li class="toctree-l1"><a class="reference internal"' | awk -F '.html">' '{print $2}' | awk -F '</a>' '{print $1}' > ${aws_cli_input_folder}/aws_list_services.txt
34+
curl -s https://awscli.amazonaws.com/v2/documentation/api/latest/reference/index.html | grep '<li class="toctree-l1"><a class="reference internal"' | awk -F '.html">' '{print $2}' | awk -F '</a>' '{print $1}' > ${aws_cli_input_folder}/aws_list_services.txt
3535
fi
3636

3737
local aws_service=$(cat ${aws_cli_input_folder}/aws_list_services.txt | peco --prompt "Select service >")
@@ -41,7 +41,7 @@ aws_get_command() {
4141
fi
4242

4343
if [ ! -s ${aws_cli_list_commands_folder}/aws_service.txt ]; then
44-
curl https://awscli.amazonaws.com/v2/documentation/api/latest/reference/$aws_service/index.html | grep '<li class="toctree-l1"><a class="reference internal"' | awk -F '.html">' '{print $2}' | awk -F '</a>' '{print $1}' > ${aws_cli_list_commands_folder}/$aws_service.txt
44+
curl -s https://awscli.amazonaws.com/v2/documentation/api/latest/reference/$aws_service/index.html | grep '<li class="toctree-l1"><a class="reference internal"' | awk -F '.html">' '{print $2}' | awk -F '</a>' '{print $1}' > ${aws_cli_list_commands_folder}/$aws_service.txt
4545
fi
4646

4747
local aws_command=$(cat ${aws_cli_list_commands_folder}/$aws_service.txt | peco --prompt "aws $aws_service" --on-cancel error)
@@ -50,15 +50,22 @@ aws_get_command() {
5050
return
5151
fi
5252

53-
local final_action=$(echo -e "echo \ndocument" | peco)
53+
local final_action=$(echo -e "input\ndocument\nhelp" | peco)
5454

5555
if [ $final_action = "document" ]; then
5656
open https://awscli.amazonaws.com/v2/documentation/api/latest/reference/$aws_service/$aws_command.html
5757
return
58+
elif [ $final_action = "help" ]; then
59+
"aws $aws_service $aws_command help"
60+
return
5861
fi
5962

6063
echo
6164
local GREEN='\033[0;32m'
6265
local NC='\033[0m'
6366
echo -e "${GREEN}aws $aws_service $aws_command${NC}"
67+
local BUFFER=$(
68+
echo "aws $aws_service $aws_command" | peco --query "$LBUFFER" --select-1
69+
)
70+
CURSOR=$#BUFFER
6471
}

0 commit comments

Comments
 (0)