workspace

ws is a CLI to manage and interpret small YAML files that specify tasks to open a project like opening an editor, launching a server or visiting a chat or documentation in the browser. It can be used to efficiently switch between work and side projects.
Installation
Then setup the ws command in your shell:
-
bash: Add this line to your
.bashrc -
fish: Add this line to your
config.fishworkspace shell fish | source - -
PowerShell: Add this line to your
profile.ps1Invoke-Expression "$(workspace shell posh)"
workspace shellprints a shell functionwsthat delegates output fromworkspacebut intercepts commands to run. This lets you change the directory and run commands directly in the shell, e.g. if they need user input.
Documentation
For the CLI, see:
ws --help
Workspaces can have the following fields:
-
path, list of stringspath to the workspace
-
tabs, list of stringstabs to open in
$BROWSER -
commands, table-
local, list of stringscommands to execute in the current shell
-
background, list of stringscommands to execute as background processes
-
external, list of stringscommands to execute in a new
$TERMINAL
-
Note:
pathis mandatory and created automatically byws new
For example, this is the workspace I use for my blog:
path: /home/matthias/code/web/blog/
commands:
local:
- git status
- sudo systemctl start nginx
background:
- code -r .
external:
- gulp
tabs:
- https://developer.mozilla.org/en-US/
- localhost
It will cd into ~/code/web/blog/, print the git status, open the directory
in visual studio code, start the gulp build in a new terminal, launch nginx
to serve the files and open localhost and MDN in the browser.