forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request withfig#269 from Monkeyank/volta
feat: add volta completion spec
- Loading branch information
Showing
1 changed file
with
192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
const defaultOptions: Fig.Option[] = [ | ||
{ | ||
name: "--verbose", | ||
description: "Enables verbose diagnostics", | ||
}, | ||
{ | ||
name: "--quiet", | ||
description: "Prevents unnecesary output", | ||
}, | ||
{ | ||
name: ["-h", "--help"], | ||
description: "Prints help information", | ||
}, | ||
]; | ||
|
||
const toolArgs: Fig.Arg = { | ||
variadic: true, | ||
name: "tool@version", | ||
}; | ||
|
||
export const completion: Fig.Spec = { | ||
name: "volta", | ||
description: "The JavaScript Launcher", | ||
subcommands: [ | ||
{ | ||
name: "fetch", | ||
description: "Fetches a tool to the local machine", | ||
|
||
args: { | ||
variadic: true, | ||
name: "tool | tool@version", | ||
}, | ||
options: [...defaultOptions], | ||
}, | ||
{ | ||
name: "install", | ||
description: "Installs a tool in your toolchain", | ||
args: { | ||
...toolArgs, | ||
}, | ||
options: [...defaultOptions], | ||
}, | ||
{ | ||
name: "uninstall", | ||
description: "Uninstalls a tool from your toolchain", | ||
args: { | ||
name: "tool", | ||
}, | ||
options: [...defaultOptions], | ||
}, | ||
{ | ||
name: "pin", | ||
description: "Pins your project's runtime or package manager", | ||
args: { | ||
...toolArgs, | ||
}, | ||
options: [...defaultOptions], | ||
}, | ||
{ | ||
name: "list", | ||
description: "Displays the current toolchain", | ||
args: { | ||
name: "tool", | ||
}, | ||
options: [ | ||
{ | ||
name: ["-c", "--current"], | ||
description: "Show the currently-active tool(s)", | ||
}, | ||
{ | ||
name: ["-d", "--default"], | ||
description: "Show your default tool(s)", | ||
}, | ||
...defaultOptions, | ||
{ | ||
name: "--format", | ||
description: "Specify output format", | ||
args: { | ||
name: "output format", | ||
suggestions: ["human", "plain"], | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "completions", | ||
description: "Generates Volta completions", | ||
args: { | ||
name: "shell", | ||
description: "Shell to generate completions for", | ||
suggestions: ["zsh", "bash", "fish", "powershell", "elivsh"], | ||
}, | ||
options: [ | ||
{ | ||
name: ["-f", "--force"], | ||
description: "Write over an existing file, if any.", | ||
}, | ||
...defaultOptions, | ||
{ | ||
name: ["-o", "--output"], | ||
description: "File to write generated completions to", | ||
args: { | ||
name: "file", | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "which", | ||
description: "Locates the actual binary that will be called by Volta", | ||
args: { | ||
variadic: true, | ||
name: "binary", | ||
template: "filepaths", | ||
}, | ||
options: [...defaultOptions], | ||
}, | ||
{ | ||
name: "setup", | ||
description: "Enables Volta for the current user", | ||
options: [...defaultOptions], | ||
}, | ||
{ | ||
name: "run", | ||
description: "Run a command with custom Node, npm, and/or Yarn versions", | ||
args: { | ||
name: "command", | ||
}, | ||
options: [ | ||
{ | ||
name: "--bundle", | ||
description: "Forces npm to be the version bundled with Node", | ||
}, | ||
{ | ||
name: "--no-yarn", | ||
description: "Disables Yarn", | ||
}, | ||
{ | ||
name: "--verbose", | ||
description: "Enables verbose diagnostics", | ||
}, | ||
{ | ||
name: "--quiet", | ||
description: "Prevents unnecesary output", | ||
}, | ||
{ | ||
name: "--node", | ||
description: "Set the custom Node version", | ||
args: { | ||
name: "version", | ||
}, | ||
}, | ||
{ | ||
name: "--npm", | ||
description: "Set the custom npm version", | ||
args: { | ||
name: "version", | ||
}, | ||
}, | ||
{ | ||
name: "--yarn", | ||
description: "Set the custom Yarn version", | ||
args: { | ||
name: "version", | ||
}, | ||
}, | ||
{ | ||
name: "--env", | ||
description: | ||
"Set an environment variable (can be used multiple times)", | ||
args: { | ||
name: "NAME=value", | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "help", | ||
description: "Prints this message or the help of the given subcommand(s)", | ||
args: { | ||
name: "subcommand", | ||
}, | ||
}, | ||
], | ||
options: [ | ||
...defaultOptions, | ||
{ | ||
name: ["-v", "--version"], | ||
description: "Prints the current version of Volta", | ||
}, | ||
], | ||
}; |