#dev #test #cli #start

build devstart

Make me: make me run dev tasks without thinking

1 unstable release

0.7.0 May 20, 2023

#503 in Build Utils

Apache-2.0

40KB
971 lines


Devstart

Devstart: run dev tasks without thinking

How To UseDownloadContributingLicense

Download

For macOS:

brew tap jondot/tap && brew install devstart

Otherwise, grab a release from releases and run bp --help:

How to Use

ds will discover tasks from:

  • Cargo (predefined)
  • node (package.json)
  • make (Makefile)
  • Feel free to submit a PR to add your favorite one

Listing tasks from all package managers (currently showing Cargo) assigned as common tasks (build, test, clean, etc.):

$ ds -l
╭────┬───────────┬─────────────────┬─────────╮
    │ task      │ exec            │ details │
├────┼───────────┼─────────────────┼─────────┤
 🦀 │ build (b)  cargo build     │         │
 🦀 │ clean (c)  cargo clean     │         │
 🦀 │ lint (l)   cargo clippy    │         │
 🟢 │ run (r)    cargo run -p ds │         │
 🚦 │ test (t)   cargo xtask ci  │         │
╰────┴───────────┴─────────────────┴─────────╯

You can use -a to show all tasks, even those tasks which aren't common:

$ ds -l -a
< list of all discovered tasks >

Run a task using an alias (b for build)

$ ds b

Or with a task name:

$ ds build

With custom build flags:

$ $(ds build -s) --release

The -s flag inlines the command as a simple string.

Or just ds to select a task to run:

$ ds
? Select task ›
 🦀  [build] cargo build
  🦀  [clean] cargo clean
  🦀  [lint] cargo clippy
  🟢  [run] cargo run -p ds
  🚦  [test] cargo xtask ci

You can override and configure your own local tasks which will overlay on top of the discovered tasks.

$ ds --init
wrote .devstart.yaml

Edit .devstart.yaml:

tasks:
  run: 
    exec: cargo run -p ds
    emoji: 🟢

  test: 
    exec: cargo xtask ci
    emoji: 🚦

Use sh: true to invoke as a shell script. This might come handy as a one-liner. In the example below we're running a Jupyter lab instance, with all the cruft of activating environments taken care of:

tasks:
  start: 
    exec: source ~/.zshrc && mamba activate myenv && jupyter-lab
    emoji: 🟢
    sh: true

Because there's only a single task, ds without any task will run it.

Note that the default shell is $SHELL, and if you want logon/terminal facilities available for scripting you need to source your respective rc file (or use a specific solution provided by your shell, e.g. .zshenv for zsh).

Shortcuts

You can also add custom shortcuts: links or common folders for this project:

tasks:
  run: 
    exec: cargo run -p ds
    emoji: 🟢

  test: 
    exec: cargo xtask ci
    emoji: 🚦

shortcuts: 
  links:
    l/actions: 
      url: https://github.com/jondot/devstart/actions
      title: Github Actions
    l/repo: 
      url: https://github.com/jondot/devstart/
      title: Repo
    l/issues: 
      url: https://github.com/jondot/devstart/issues
      title: Issues

  folders:
    f/dist: 
      path: dist
      title: Dist folder

To use:

  • link : ds l/actions
  • folder: use shell expansion to automatically cd in your current session: $(ds f/dist)

Shortcuts are not interactively selectable, but appear in listings (ds -l)

Contributing

We are accepting PRs. Feel free to submit PRs.

To all Contributors - you make this happen, thanks!

License

Copyright (c) 2023 @jondot. See LICENSE for further details.

Dependencies

~11–21MB
~329K SLoC