Skip to content

Commit 2f56f2a

Browse files
add instructions on how to setup command completion for awslocal (#55)
* add instructions on how to setup command completion for awslocal * Update README.md Co-authored-by: Harsh Mishra <erbeusgriffincasper@gmail.com>
1 parent 651d037 commit 2f56f2a

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ pip install awscli-local
2222

2323
## Usage
2424

25-
The `awslocal` command has the same usage as the `aws` command. For detailed usage,
26-
please refer to the man pages of `aws help`.
25+
The `awslocal` command has the same usage as the `aws` command. For detailed usage, please refer to the manual pages of `aws help`.
2726

2827
## Example
2928

@@ -49,13 +48,44 @@ localstack is bound to another interface (i.e. docker-machine).
4948
with `USE_SSL=true` enabled). Defaults to `false`.
5049
* `DEFAULT_REGION`: Set the default region. Overrides `AWS_DEFAULT_REGION` environment variable.
5150

51+
## Completion
52+
53+
`awscli` provides a neat command completion feature which is compatible with most modern shells which can also be used with `awslocal`.
54+
55+
### Usage instructions
56+
57+
The command completion will automatically suggest commands and parameters when using the completion key (which is typically the _Tab_ key):
58+
59+
```sh
60+
$ awslocal dynamodb d<TAB>
61+
delete-backup describe-global-table
62+
delete-item describe-global-table-settings
63+
delete-table describe-limits
64+
describe-backup describe-table
65+
describe-continuous-backups describe-table-replica-auto-scaling
66+
describe-contributor-insights describe-time-to-live
67+
describe-endpoints
68+
```
69+
70+
### Configuration
71+
72+
- Follow the official guide on setting up the command completion for the `aws` CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html
73+
- While enabling the command completion for your shell, **make sure to register the completion for `awslocal` as well**.
74+
75+
For example, if you are using `bash`, you would add the following commands to your `~/.bashrc`:
76+
```sh
77+
complete -C '/usr/local/bin/aws_completer' aws
78+
complete -C '/usr/local/bin/aws_completer' awslocal
79+
```
80+
- Follow the instructions for the shell you are using. For some shells you might need to register a different command or enable certain compatibility plugins (like `zsh`).
81+
5282
## Limitations
5383

5484
* Please note that there is a known limitation for using the `cloudformation package ...` command with the AWS CLI v2. The problem is that the AWS CLI v2 is [not available as a package on pypi.org](https://github.com/aws/aws-cli/issues/4947), but is instead shipped as a binary package that cannot be easily patched from `awslocal`. To work around this issue, you have 2 options:
5585

5686
- Downgrade to the v1 AWS CLI (this is the recommended approach)
5787
- There is an inofficial way to install AWS CLI v2 from sources. We do not recommend this, but it is technically possible. Also, you should install these libraries in a Python virtualenv, to avoid version clashes with other libraries on your system:
58-
```console
88+
```sh
5989
virtualenv .venv
6090
. .venv/bin/activate
6191
pip install https://github.com/boto/botocore/archive/v2.zip https://github.com/aws/aws-cli/archive/v2.zip

0 commit comments

Comments
 (0)