vstask 0.2.0

Run VS Code task from the terminal
vstask-0.2.0 is not a library.
Visit the last successful build: vstask-0.3.0

vstask

A command-line tool to run VS Code tasks from the terminal.

Overview

vstask allows you to execute VS Code tasks defined in .vscode/tasks.json directly from the command line, without needing to open VS Code. It supports all the features of VS Code tasks including:

  • Shell and process tasks
  • Platform-specific configurations (Windows, Linux, macOS)
  • Working directory changes (cwd)
  • Environment variables
  • Background tasks
  • Variable substitution (e.g., ${workspaceFolder}, ${env:VAR})

Installation

Using Cargo

If you have Rust installed, you can install vstask directly from crates.io:

cargo install vstask

This will install the binary to ~/.cargo/bin/ which should be in your PATH.

From Source

cargo build --release

The binary will be available at target/release/vstask.

You can then copy it to a location in your PATH:

cp target/release/vstask ~/.local/bin/
# or
sudo cp target/release/vstask /usr/local/bin/

Usage

Run a Task

vstask "Task Name"

List All Available Tasks

vstask --list
# or
vstask -l

Run Without Arguments

Running vstask without any arguments will display a list of available tasks:

vstask

Shell Completion

Zsh

Add the following to your ~/.zshrc for dynamic task name completion:

# --- vstask Dynamic Completion ---
_vstask_tasks_completion() {
    local tasks

    # Capture the clean output, splitting by newline (f flag).
    # No need for tr or quote stripping anymore!
    tasks=(${(f)"$(vstask --list 2>/dev/null)"})

    # Add the clean task names to Zsh's completion list.
    compadd "$tasks[@]"
}
compdef _vstask_tasks_completion vstask

After adding this, reload your shell configuration:

source ~/.zshrc

Now you can use tab completion when typing task names:

vstask <TAB>

Requirements

  • A .vscode/tasks.json file in your project directory
  • Rust 1.70+ (for building from source)

License

Licensed under either of:

  • MIT License
  • Apache License, Version 2.0

at your option.