- Notifications
You must be signed in to change notification settings - Fork8
A CLI/TUI that simplifies launching VSCode projects, with a focus on dev containers
License
michidk/vscli
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A CLI/TUI which makes it easy to launchVisual Studio Code (vscode)dev containers. Also supports other editors likeCursor.
Readhere about the journey of reverse engineering Microsoft's dev container CLI in order to make this.
- A shorthand for launching vscode projects (to be used like the
code
command but with dev container support) - Supports different editors like
vscode
,vscode-insiders
,cursor
and other vscode forks - Detects whether a project is adev container project, and launches the dev container instead
- Supportsmultiple dev containers in the same project
- Tracks your projects and allows you to open them using a CLI-based UI
Installvscli using cargo on Windows or Linux:
cargo install vscli
Installvscli using homebrew on Linux or Mac:
brew install michidk/tools/vscli
Installvscli using Chocolatey on Windows:
choco install vscli
Installvscli using winget on Windows:
winget install vscli
You can set a shorthand alias forvscli
in your shell's configuration file:
alias vs="vscli open"alias vsr="vscli recent"
After installation, thevscli
command will be available:
Usage: vscli [OPTIONS] <COMMAND>Commands: open Opens a dev container recent Opens an interactive list of recently used workspaces help Print this message or the help of the given subcommand(s)Options: -s, --history-path <HISTORY_PATH> Overwrite the default path to the history file [env: HISTORY_PATH=] -d, --dry-run Whether to launch in dry-run mode (not actually open vscode) [env: DRY_RUN=] -v, --verbose... Increase logging verbosity -q, --quiet... Decrease logging verbosity -h, --help Print help -V, --version Print version
Opens a dev container.
Usage: vscli open [OPTIONS] [PATH] [ARGS]...Arguments: [PATH] The path of the vscode project to open [default: .] [ARGS]... Additional arguments to pass to the editor [env: ARGS=]Options: -c, --command <COMMAND> The editor command to use (e.g. "code", "code-insiders", "cursor") [env: COMMAND=] -s, --history-path <HISTORY_PATH> Overwrite the default path to the history file [env: HISTORY_PATH=] -b, --behavior <BEHAVIOR> Launch behavior [possible values: detect, force-container, force-classic] -d, --dry-run Whether to launch in dry-run mode (not actually open vscode) [env: DRY_RUN=] --config <CONFIG> Overwrites the path to the dev container config file [env: CONFIG=] -v, --verbose... Increase logging verbosity -q, --quiet... Decrease logging verbosity -h, --help Print help (see more with '--help')
Opens an interactive list of recently used workspaces.
Usage: vscli recent [OPTIONS] [ARGS]...Arguments: [ARGS]... Additional arguments to pass to the editor [env: ARGS=]Options: --hide-instructions Hide the instruction message in the UI -s, --history-path <HISTORY_PATH> Overwrite the default path to the history file [env: HISTORY_PATH=] -d, --dry-run Whether to launch in dry-run mode (not actually open vscode) [env: DRY_RUN=] --hide-info Hide additional information like strategy, command, args and dev container path in the UI -c, --command <COMMAND> The editor command to use (e.g. "code", "code-insiders", "cursor") [env: COMMAND=] -v, --verbose... Increase logging verbosity -b, --behavior <BEHAVIOR> Launch behavior [possible values: detect, force-container, force-classic] -q, --quiet... Decrease logging verbosity --config <CONFIG> Overwrites the path to the dev container config file [env: CONFIG=] -h, --help Print help (see more with '--help')
Both theopen
andrecent
commands share the same set of launch arguments:
--command
: Specify which editor command to use (e.g., "code", "code-insiders", "cursor")--behavior
: Set the launch behavior ("detect", "force-container", "force-classic")--config
: Override the path to the dev container config file- Additional arguments can be passed to the editor executable by specifying them after
--
Therecent
command additionally supports:
--hide-instructions
: Hide the keybinding instructions from the UI--hide-info
: Hide additional information like strategy, command, args and dev container path
Key/Key Combination | Action | Description |
---|---|---|
Esc ,Ctrl+Q orCtrl+C | Quit | Exits the application. |
Down orCtrl+J | Select Next | Moves to the next selectable item. |
Up orCtrl+K | Select Previous | Moves to the previous selectable item. |
KeypadBegin orCtrl+1 | Select First | Selects the first item. |
End orCtrl+0 | Select Last | Selects the last item. |
Enter orCtrl+O | Open Selected | Opens the currently selected item. |
Delete ,Ctrl+R , orCtrl+X | Delete Selected Entry | Deletes the currently selected item. |
Note: If an input does not match any of the defined keybindings, it is treated as part of a search input.
Mouse Action | Description |
---|---|
Left Click | Selects an item. Clicking the same item again opens it. |
Mouse Wheel | Scrolls through the list, moving selection up/down. |
There are three launch behaviors:
force-classic
: Launch vscode without a dev containerforce-container
: Launch vscode with a dev container, error if no dev container is founddetect
: Detect whether the project is a dev container project, and launch the dev container if it is
The detection algorithm determines which dev container config to launch.
- First, check whether a dev container config was specified via the
--config
flag -> launch it - Then loads the first dev container it finds
- If more than one exists -> show a interactive list of dev containers and let the user select one
- If one exists -> launch it
- If none exists -> launch vscode normally without a dev container
You can launch a project using the default behavior:
vscli open# open vscode in the current directoryvscli open.# open vscode in the current directoryvscli open /path/to/project# open vscode in the specified directory
The default behavior tries to detect whether the project is adev container project. If it is, it will launch the dev container instead - if not it will launch vscode normally.
You can change the launch behavior using the--behavior
flag:
vscli open --behavior force-container.# force open vscode dev container (even if vscli did not detect a dev container)vscli open --behavior force-classic.# force open vscode without a dev container (even if vscli did detect a dev container)
When you open a project containing more than one dev container config, you will be prompted to select one:
You can specify which editor command to use with the--command
flag:
vscli open --command cursor.# open using cursor editorvscli open --command code.# open using vscode (default)vscli open --command code-insiders.# open using vscode insiders
Additional arguments can be passed to the editor executable, by specifying them after--
:
vscli open. -- --disable-gpu# open the current directory without GPU hardware acceleration
Read more about the editor flags by executingcode --help
(orcursor --help
, etc).
You can open a CLI-based user interface to display a list of recently opened projects using therecent
command:
vscli recent# open the CLI-based UI to select a recently opened project to openvscli recent --command cursor# open the selected project with cursor, ignoring the editor stored in historyvscli recent --behavior force-container# force open the selected project in a dev containervscli recent --command cursor --behavior detect# open with cursor and detect if dev container should be usedvscli recent --config .devcontainer/custom.json# open with a specific dev container configvscli recent -- --disable-gpu# pass additional arguments to the editorvscli recent --hide-instructions# hide the keybinding instructions from the UIvscli recent --hide-info# hide additional information like strategy, command, args and dev container path
The UI mode provides a convenient way to browse and manage your recent workspaces, with customizable display options and full support for all launch configurations.
About
A CLI/TUI that simplifies launching VSCode projects, with a focus on dev containers