commandline complete for core
Complete a string using the default completions.
Signature
> commandline complete {flags}
Flags
--detailed, -d: Output completions as records, in the format expected from custom completers.--type {string}: The type of values to allow as completions.
Input/output types:
| input | output |
|---|---|
| nothing | oneof<list<string>, list<record>> |
| string | oneof<list<string>, list<record>> |
Examples
List completions for command names.
> def my-bar [] {}; def my-baz [] {}; 'my-' | commandline complete
╭───┬────────╮
│ 0 │ my-bar │
│ 1 │ my-baz │
╰───┴────────╯List completions for flags for a command.
> def cmd [--flag(-f): string] {}; 'cmd -' | commandline complete
╭───┬────────╮
│ 0 │ --flag │
│ 1 │ -f │
╰───┴────────╯Complete filepath or glob arguments.
> './' | commandline complete --type pathExtend builtin completions for the current commandline.
> commandline complete | append 'foo'Notes
This command can be used to obtain the completions that Nushell would normally provide for the given commandline contents. Completions will be provided as if the cursor is placed at the end of the given string.
If no input is provided, the current commandline contents will be used instead.