Skip to content

Commit 0bdf55f

Browse files
authored
Add custom completions for aws-cli (#1073)
Aws-cli ships with a dedicated completion binary that only needs to be passed current commandline to work. Space is appended to returned results so that completing subcommands can be done simply by pressing tab multiple times
1 parent 861a997 commit 0bdf55f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def complete-commands [
2+
context: string
3+
] {
4+
with-env {COMP_LINE: $context} {
5+
aws_completer
6+
| lines
7+
| each {|x| $"($x) "}
8+
}
9+
}
10+
11+
export extern "aws" [
12+
...command: string@complete-commands
13+
]

custom-completions/aws/readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Amazon Web Services CLI completions
2+
3+
A Nushell extern definition and completers for [Amazon Web Services CLI `aws`](https://aws.amazon.com/cli/).
4+
5+
This module utilizes the `aws_completer` binary that ships with `aws` to provide completions
6+
7+
## How to use
8+
9+
Add `source path/to/aws-completions.nu` to your `config.nu` (`$nu.config-path`).

0 commit comments

Comments
 (0)