8000 GitHub - kkukshtel/tman: A terminal picker for VS Code tasks.json tasks, built with Spectre.Console. Runs tasks in Rex floating panes. · GitHub
[go: up one dir, main page]

Skip to content
kkukshtelPublic

About

A terminal picker for VS Code tasks.json tasks, built with Spectre.Console. Runs tasks in Rex floating panes.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

tman

A terminal task picker for VS Code style tasks.json files, built with Spectre.Console.

Run tman in a folder and it lists the tasks from .vscode/tasks.json and tasks.json. Pick one and it runs. Inside Rex, each task opens in its own floating pane in tman's tab, so tman keeps running and you can start more tasks while the first is still going.

tman listing a project's tasks, with a running watch task and a finished build in Rex floating panes

dnx tman

Running it

Requires the .NET 10 SDK or later. tman is published on nuget.org as a .NET tool, so dnx runs it without installing anything:

cd my-project
dnx tman            # run it in the folder whose tasks you want
dnx tman ../api     # or point it at a folder or a tasks.json file

Or install it as a tman command:

dotnet tool install -g tman   # later: dotnet tool update -g tman

To run it from source:

git clone https://github.com/kkukshtel/tman
cd my-project
dotnet run --project ../tman

Releasing

Pushing a version tag publishes that version to nuget.org through .github/workflows/publish.yml:

git tag v0.1.0 && git push origin v0.1.0

The tag sets the package version. The <Version> in Tman.csproj only names local builds. tman's own .vscode/tasks.json has a release task that asks for the version and pushes the tag.

Using it

Key Action
↑ / ↓, Home / End Move (wraps around)
Type Jump to a matching task
Enter Run the task, or pick Refresh / Quit
Ctrl+C Quit
  • Live reload. tman checks the tasks.json files a couple of times a second. When one is created, edited or deleted, the menu redraws. A file with a syntax error shows the line and column, and the menu recovers when you fix it. Refresh reloads on demand.
  • Floating panes. Each task gets its own pane, labelled with the task name. The pane shows the command, the output and the exit code, then waits for Enter before closing. Ctrl+C stops the task and leaves the pane open so you can read the output. With "presentation": { "close": true } the pane closes when the task ends. A task that fails straight away keeps its pane open either way.
  • Inputs. ${input:...} values are asked for in tman before the task starts: promptString (including password) and pickString.

Options

tman [options] [path]

  path              A directory (reads .vscode/tasks.json and tasks.json) or a tasks.json file.
  -r, --run LABEL   Run one task and exit. Handy for key bindings.
  -l, --list        Print the tasks as a table and exit.
  --inline          Run tasks in this terminal instead of Rex floating panes.
  --no-focus        Keep focus on tman when a floating pane opens.
  --no-rc           Don't read ~/.zshrc (or your shell's rc file) in task panes.

Outside Rex (REX_BLOCK isn't set), tman runs tasks in its own terminal and returns to the menu afterwards.

Supported tasks.json features

  • JSON with comments and trailing commas
  • shell, process and npm tasks. npm tasks use pnpm, yarn or bun when their lock file is present. Other types that have a command (such as cppbuild) run like process tasks.
  • args, including { "value": ..., "quoting": "escape" | "strong" | "weak" }
  • options.cwd, options.env and options.shell, both global and per task
  • osx / linux / windows overrides, both global and per task
  • group, both a plain string and { "kind", "isDefault" }. Groups become menu sections, and the default build task gets a ★ and starts selected.
  • detail, hide, presentation.close
  • dependsOn with dependsOrder (parallel by default, or sequence). Dependencies can be labels or { "type": "npm", "script": ... }. Cycles are reported instead of run.
  • isBackground dependencies, such as watchers and dev servers, are started without waiting for them. They keep running until you close the pane.
  • Variables: ${workspaceFolder}, ${workspaceFolderBasename}, ${cwd}, ${userHome}, ${env:NAME}, ${pathSeparator}, ${/} and ${input:id}

Not supported, because they need the VS Code editor: ${file} and other editor variables, ${config:...}, ${command:...}, command inputs, and problem matchers. A task that uses one of these variables stops with a message that names it, so it never runs with a broken command line.

How it runs a task

tman turns the task and its dependencies into a small POSIX sh script. Each step is cd plus exec, with every value single-quoted, and dependencies are combined in sequence or in parallel. In Rex it then calls rex api call session.new_layer to open a floating terminal in tman's window that runs the script. That terminal goes through your login shell, so tasks get the same PATH as your other terminals.

About

A terminal picker for VS Code tasks.json tasks, built with Spectre.Console. Runs tasks in Rex floating panes.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0