## Functions
Install and enable completion on user system. It'll ask for:
Public: Main utility to extract information from command line arguments and Environment variables, namely COMP args in "plumbing" mode.
options - The options hash as parsed by minimist, plus an env property representing user environment (default: { env: process.env }) :_ - The arguments Array parsed by minimist (positional arguments) :env - The environment Object that holds COMP args (default: process.env)
Examples
const env = tabtab.parseEnv(); // env: // complete A Boolean indicating whether we act in "plumbing mode" or not // words The Number of words in the completed line // point A Number indicating cursor position // line The String input line // partial The String part of line preceding cursor position // last The last String word of the line // lastPartial The last word String of partial // prev The String word preceding last
Returns the data env object.
Helper to normalize String and Objects with { name, description } when logging out.
Main logging utility to pass completion items.
This is simply an helper to log to stdout with each item separated by a new line.
Bash needs in addition to filter out the args for the completion to work (zsh, fish don't need this).
Object | to use with namely `name` and `completer` |
## parseEnv()
Public: Main utility to extract information from command line arguments and
Environment variables, namely COMP args in "plumbing" mode.
options - The options hash as parsed by minimist, plus an env property
representing user environment (default: { env: process.env })
:_ - The arguments Array parsed by minimist (positional arguments)
:env - The environment Object that holds COMP args (default: process.env)
Examples
const env = tabtab.parseEnv();
// env:
// complete A Boolean indicating whether we act in "plumbing mode" or not
// words The Number of words in the completed line
// point A Number indicating cursor position
// line The String input line
// partial The String part of line preceding cursor position
// last The last String word of the line
// lastPartial The last word String of partial
// prev The String word preceding last
Returns the data env object.
**Kind**: global function
## completionItem(item)
Helper to normalize String and Objects with { name, description } when logging out.
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| item | String \| Object | Item to normalize |
## log(Arguments)
Main logging utility to pass completion items.
This is simply an helper to log to stdout with each item separated by a new
line.
Bash needs in addition to filter out the args for the completion to work
(zsh, fish don't need this).
**Kind**: global function
| Param | Type | Description |
| --- | --- | --- |
| Arguments | Array | to log, Strings or Objects with name and description property. |