Skip to content

Commit

Permalink
feat(cli): add bash completions support
Browse files Browse the repository at this point in the history
  • Loading branch information
umbopepato committed Sep 23, 2020
1 parent 9dcff3e commit 84a7214
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
15 changes: 10 additions & 5 deletions README.md
Expand Up @@ -384,8 +384,9 @@ to execute the `start` script.
## Exporting scripts

You may find yourself in a situation where you want to use velociraptor to manage your scripts during development, but you're not comfortable installing it (or just can't install it) in your production environment.
In this case the `export` subcommand may be of help: it allows you to export one or more scripts as standalone executable shell files:
If you want to use velociraptor to manage your scripts, but you want to be able to execute them in environments where
you can't (or don't want to) install vr, the `export` subcommand may be of help: it allows you to export one or more
scripts as standalone executable shell files together with their env variables, Deno cli options etc.:

```sh
$ vr export [SCRIPTS]...
Expand All @@ -402,7 +403,7 @@ For example, run
$ vr export start
```

to export the `start` script, together with its env variables, deno cli options etc. Now you can execute it by running
to export the `start` script. Now you can execute it by running

```sh
$ ./bin/start [ARGS]...
Expand All @@ -422,13 +423,17 @@ Velociraptor searches for script files up the folder tree starting from the dire

## Shell completions

To enable zsh tab-completion for velociraptor commands, add the following line to your `~/.zshrc`
To enable shell tab-completion for velociraptor commands, add the following line to your `~/.zshrc`

```sh
source <(vr completions zsh)
```

> Bash is not supported yet, but will be added.
or `~/.bashrc`

```sh
source <(vr completions bash)
```

## Editor support

Expand Down
1 change: 1 addition & 0 deletions deps.ts
Expand Up @@ -18,4 +18,5 @@ export { LevelName } from "https://deno.land/std@0.70.0/log/levels.ts";
export {
Command,
StringType,
CompletionsCommand,
} from "https://deno.land/x/cliffy@v0.14.1/command/mod.ts";
3 changes: 2 additions & 1 deletion src/cli/commands/vr.ts
@@ -1,4 +1,4 @@
import { Command } from "../../../deps.ts";
import { Command, CompletionsCommand } from "../../../deps.ts";
import { version } from "../../version.ts";
import { ScriptIdType } from "../script_id_type.ts";
import { ConfigData } from "../../load_config.ts";
Expand Down Expand Up @@ -30,6 +30,7 @@ export class VrCommand extends Command {
})
.command("run", new RunCommand(this.configData))
.command("export", new ExportCommand(this.configData))
.command("completions", new CompletionsCommand())
.reset();
}
}

0 comments on commit 84a7214

Please sign in to comment.