Skip to content

jharrilim/runt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

runt

Runt is a polyglot command runner designed for managing menial commands. It automatically generates a CLI based off of a Runtfile in your current working directory. This Runtfile is a simple markdown file that contains a list of commands and their descriptions. It even works with nested commands. Check out the example Runtfile in this repo!

Install on Mac

brew tap jharrilim/runt
brew install runt

Usage

To use runt, pass the name of a command to the runt command.

runt [command]

Todo

  • Switch to typed recursive decent parsing to properly support different types of in headers and paragraphs, such as text, links, and a combination thereof
  • Support other shells
  • Setup some syntax for declaring arguments, probably using lists

Runtfile

The Runtfile consists of three parts:

  1. The command name, which is declared in a header
  2. A description for the command
  3. Code to be executed for that command

Command Name

The command name is declared in a header using the # character. The number of # characters determines the level of nesting your command will reside in, relative to the nearest parent command. For example, the following Runtfile:

# Containers

## ls

List all containers

```bash
docker ps -a
```

will generate a CLI that has a container command with an ls subcommand. This is how you would run the command with runt:

runt container ls

There is even autogenerated help which will include the description under ls! Running this command:

runt container --help

Will give you:

Usage: runt container [COMMAND]

Commands:
  ls    List all containers
  help  Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

Command names can also have spaces or capital letters. Spaces are automatically converted into hyphens and capital letters are automatically converted into lowercase letters. For example, the following Runtfile:

# Containers

## List All

List all containers

```bash
docker ps -a
```

will generate a CLI that has a container command with a list-all subcommand:

runt container list-all