Skip to content

v1.0.0-alpha.1

Pre-release
Pre-release

Choose a tag to compare

@MartinHelmut MartinHelmut released this 13 Jun 11:45
· 69 commits to main since this release

This is the first, non production, release of Litr (Language Independent Task Runner) [Milestone].

Platform support

This release is only build and tested on macOS 11.4 (with Apple M1 support) and can be installed via Homebrew. If you want to run Litr in another environment you need to build it from source. You can find out how inside the CONTRIBUTING.md provided in the repo root. Later releases will also support non M1 Apple hardware, Windows [#37] and common Linux distributions [#38].

Features

  • Configure script inside a litr.toml or .litr.toml file in a project, parent folder(s) or your user directory
  • Scripts can also contain descriptions, examples, silent outputs and directory configurations
  • Nested scripts
  • Multiple scripts under one execution name
  • Define parameters for your scripts
  • Parameters have a description, can have a shortcut, different types (string, array of strings, boolean) and a default value
  • Conditional parameter parsing inside script
  • Auto generated help based on your configuration file

Quick Tour

Installation

Currently supported platforms are macOS (with Apple M1 Support).

brew tap krieselreihe/litr
brew install litr

Setup

Create a litr.toml or .litr.toml file and add some script and parameters to it, e.g.:

# litr.toml
[commands]
hello = "echo Hello %{name}"
bye = "echo Bye %{name}"

[params.name]
description = "Say a name."
default = "Unkown"

And run it either with or without parameter:

litr hello  # "Hello Unkown"
litr hello --name=Perrin  # "Hello Perrin"

You can also call multiple:

litr hello,bye

Or set the parameter for multiple by defining the parameter before the commands:

litr --name=Perrin hello,bye

Nested commands

# litr.toml
[commands.build.cpp]
script = "..."

[commands.build.java]
script = "..."

Nested commands can be executed all one-by-one:

litr build  # Will run `cpp` and then `java`

Or via single command:

litr build java  # Only runs the `java` build command

Complex example

Here an example with multiple scripts and conditional parsing:

# litr.toml
[commands.hello]
script = [
  "echo 'Hello user'",
  "echo 'Username is %{name}'"
]
description = "Greetings to the user"
example = "litr -n=Mat hello"

[commands.if]
script = "echo %{show 'if defined'}"

[commands.or]
script = "echo %{show 'if defined' or 'not'}"

[params.name]
shortcut = "n"
description = "Define a name."
default = "Unknown"

[params.show]
description = "Show data."
type = "boolean"

This can generate a help view via litr --help:

Litr - Language Independent Task Runner [version 1.0.0-alpha.1]
  Configuration file found under: /path/to/litr.toml

Usage: litr command [options]

Commands:
  or     [--show]
  if     [--show]
  hello  [--name=<option>]
             Greetings to the user
             ┌ Example(s):
             └ litr -n=Mat hello

Options:
  -h --help  Show this screen.
  -v --version Show current Litr version.
     --show  Show data.
  -n --name  Define a name.
             Default option is: "Unknown"

Here called with different options:

litr or         # "not"
litr or --show  # "if defined"

Remember, this is still an alpha. Report any bugs. Feedback welcome: info@krieselreihe.com