vscli 0.1.8

A CLI tool to launch vscode projects, which supports devcontainers.
vscli-0.1.8 is not a library.

vscli

MIT License Continuous integration Crates.io Homebrew Chocolatey

A CLI tool to launch vscode projects, which supports devcontainer.

Screenshot showing the recent UI feature.

Features

  • A shorthand for launching vscode projects (to be used like the code command but with devcontainer support)
  • Detects whether a project is a devcontainer project, and launches the devcontainer instead
  • Supports the insiders version of vscode
  • Tracks your projects and allows you to open them using a CLI-based UI

Installation

Packaging status

Cargo

Install vscli using cargo on Windows or Linux:

cargo install vscli

Homebrew

Install vscli using homebrew on Linux:

brew install michidk/tools/vscli

Chocolatey

Install vscli using Chocolatey on Windows:

choco install vscli

Additional steps

You can set a shorthand alias for vscli in your shell's configuration file:

alias vs="vscli --verbosity error"
alias vsr="vscli recent"

Usage

Commandline

After installation, the vscli command will be available:

Usage: vscli [OPTIONS] [PATH] [ARGS]... [COMMAND]

Commands:
  recent  Opens an interactive list of recently used workspaces
  help    Print this message or the help of the given subcommand(s)

Arguments:
  [PATH]
          The path of the vscode project to open [default: .]

  [ARGS]...
          Additional arguments to pass to vscode

Options:
  -b, --behavior <BEHAVIOR>
          Launch behavior [default: detect]

          Possible values:
          - detect:          Use devcontainer if it was detected
          - force-container: Force open with devcontainer, even if no config was found
          - force-classic:   Ignore devcontainer

  -i, --insiders
          Whether to launch the insider's version of vscode

  -d, --dry-run
          Whether to launch in dry-run mode (not actually open vscode)

  -v, --verbosity <VERBOSITY>
          The verbosity of the output [default: info]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Examples

Launching a project

You can launch a project using the default behavior:

vscli                               # open vscode in the current directory
vscli .                             # open vscode in the current directory
vscli /path/to/project              # open vscode in the specified directory

The default behavior tries to detect whether the project is a devcontainer project. If it is, it will launch the devcontainer instead - if not it will launch vscode normally.

You can change the launch behavior using the --behavior flag:

vscli --behavior force-container . # force open vscode devcontainer (even if vscli did not detect a devcontainer)
vscli --behavior force-classic .   # force open vscode without a devcontainer (even if vscli did detect a devcontainer)

You can launch the insiders version of vscode using the --insiders flag:

vscli --insiders .                  # open vscode insiders in the current directory

Additional arguments can be passed to the code executable, by specifying them after --:

vscli . -- --disable-gpu            # open vscode in the current directory without GPU hardware acceleration

Read more about the code flags, by executing code --help.

CLI UI

You can open a CLI-based user interface to display a list of recently opened projects using the recent command:

vscli recent                        # open the CLI-based UI to select a recently opened project to open

Use the arrow keys to navigate the list, and press enter or o to open the selected project. Use q to quit the UI. You can delete entries by highlighting them and pressing x or the delete key.