Skip to content
Permalink
Browse files

feat: init aws command cache using botocore

  • Loading branch information...
handlename committed Jul 4, 2019
1 parent 265bf11 commit 8c24e5b3eead57d609fb4a92a2e3f5b2adf7cbf6
Showing with 22 additions and 7 deletions.
  1. +22 −7 config_aws.fish
@@ -25,17 +25,32 @@ function __init-aws-help
set -l tmpdir (mktemp -d)
set -l cachedir (dirname (status --current-filename))/cache
set -l outfile "$cachedir/awscli_commands.txt"
rm -f "$outfile"

mkdir -p "$cachedir"
git clone --depth 1 git@github.com:aws/aws-cli.git "$tmpdir"
git clone --depth 1 git@github.com:boto/botocore.git "$tmpdir"

ls "$tmpdir/awscli/examples" \
| xargs -I{} -n1 find "$tmpdir/awscli/examples/{}" \
| egrep '\.rst$' \
| perl -nE 'chomp; s/\.rst$//; @p=split "/"; say $p[-2]." ".$p[-1]' \
> "$outfile"
set -l services (
find "$tmpdir/botocore/data" -depth 1 -type d \
| perl -nE '@parts=split "/"; print $parts[-1]' \
| sort \
)

for service in $services
set -l file (find "$tmpdir/botocore/data/$service" -name 'service-2.json' | tail -1)
set -l operations (
cat "$file" \
| jq -r '.operations | keys | .[]' \
| perl -pnE 's/([A-Z])/-\l\1/g; s/-//' \
| sort \
)

for operation in $operations
echo "$service $operation" >> "$outfile"
end
end

echo "aws command list created at $outfile"
echo "aws command list has been created at $outfile"

rm -rf "$tmpdir"
end

0 comments on commit 8c24e5b

Please sign in to comment.
You can’t perform that action at this time.