https://github.com/woudsma/workspaces-cli
A small command-line tool to easily list and open all your VS Code Workspaces
https://github.com/woudsma/workspaces-cli
cli code list select studio virtual vs-code vscode workspace workspaces
Last synced: 2 months ago
JSON representation
A small command-line tool to easily list and open all your VS Code Workspaces
- Host: GitHub
- URL: https://github.com/woudsma/workspaces-cli
- Owner: woudsma
- License: mit
- Created: 2020-02-27T16:50:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-28T23:10:48.000Z (over 5 years ago)
- Last Synced: 2025-04-11T17:45:44.784Z (2 months ago)
- Topics: cli, code, list, select, studio, virtual, vs-code, vscode, workspace, workspaces
- Language: JavaScript
- Homepage:
- Size: 1.35 MB
- Stars: 15
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Workspaces CLI
A small command-line tool to easily list all your different VS Code Workspaces.
`ws` searches for all `.code-workspace` files in a user-specified root directory.
By default, `ws` searches only 1 level deep to prevent traversing folders like `node-modules`, `vendor`, etc.
---
## Installation
```sh
npm i -g @woudsma/workspaces-cli
```## Requirements
- Node.js version >= 8
- Make sure you have installed the `code` command in your `$PATH` - [How to](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line)## Usage
#### Create a workspace
Create a workspace by opening a project in VS Code, optionally add more projects to your current workspace.
Save the workspace with:
```
File -> Save Workspace As...
```
#### Run `ws`
I've made a `_workspaces` folder in my personal projects folder, where I keep workspaces that include multiple projects. Other workspaces are usually stored in their own project folder. `ws` searches 1 level deep.
More info on [Multi-root workspaces](https://github.com/microsoft/vscode-docs/blob/master/docs/editor/multi-root-workspaces.md).
Example:
```
$ ws
Workspaces root directory: /Users/woudsma/Projects
? Select workspace …
❯ _workspaces/hasura-test
_workspaces/kirby-react-test
_workspaces/mount-spaces
workspaces-cli/workspaces-cli
```
The workspace for this project is saved at `/Users/woudsma/Projects/workspaces-cli/workspaces-cli.code-workspace` for example.#### CLI
```
$ ws [-h|--help]
```
`ws` is an alias of `workspaces`.## First time configuration
`ws` reads your workspaces root directory from `~/.workspacesrc`.
If no configuration can be found, `ws` will try to create a `~/.workspacesrc` file with the workspaces root directory that you've provided.
```
$ ws
No configuration found in /Users/woudsma/.workspacesrc
Creating /Users/woudsma/.workspacesrc
? Enter workspaces root directory, e.g. ~/Projects › ~/
```
## Configuration
Multiple root directories can be specified by adding them to `WORKSPACES_ROOT_DIR` in `~/.workspacesrc`, seperated by comma.
Example:
```sh
# in ~/.workspacesrc
WORKSPACES_ROOT_DIR=/Users/woudsma/Projects,/Users/woudsma/Company/clients
```Turn off the subshell when selecting a workspace.
```sh
# USE_SUBSHELL=true (default)
echo USE_SUBSHELL=false >> ~/.workspacesrc
```
The default search depth can be changed by adding `READDIR_DEPTH=` to `~/.workspacesrc`.
```sh
# READDIR_DEPTH=1 (default)
echo READDIR_DEPTH=2 >> ~/.workspacesrc
```
---
Pull requests are welcome!---
## LicenseMIT.