Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

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:

inputoutput
nothingoneof<list<string>, list<record>>
stringoneof<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 path

Extend 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.