• Stars
    star
    28
  • Rank 882,216 (Top 18 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Command line for your projects

Runfile - command line for your projects

Gem Version Build Status Maintainability


A beautiful command line utility builder
Rake-inspired ✦ Docopt inside
runfile.dannyb.co


Runfile lets you create command line tools in a way similar to Rake, but with the full power of Docopt command line options.

You create a runfile, and execute commands with run command arguments -and --flags.

Runfile is designed primarily for Ruby developers, but if you need to add a command line "toolbelt" for your projects, you can use it regardless.

Demo

Runfile Demo

Install

$ gem install runfile --pre

Quick Start

$ run new        # create a new runfile
$ run --help     # show the usage patterns
$ vi runfile     # edit the runfile

Example

A simple runfile looks like this. You can get this template by running run new (in a directory without other runfiles).

title   'Greeter'
summary 'A sample runfile'

usage  'hello [NAME --shout]'
help   'Say hello'
option '--shout, -s', 'Greet louder'
action 'hello' do |args|
  name = args['NAME'] || 'You...'
  message = "Hello #{name}"
  message = "#{message.upcase}!" if args['--shout']

  say "gu`#{message}`"
end

You can then run it by executing this command:

$ run hello Luke
Hello Luke

It will behave in the same way you expect any standard command line interface to behave,

# Show usage summary
$ run
Usage:
  run hello [NAME --shout]
  run (--help | -h)

# Show detailed help
$ run --help
Greeter

  A sample runfile

Usage:
  run hello [NAME --shout]
  run (--help | -h)

Commands:
  hello
    Say hello

Options:
  --shout, -s
    Greet louder

  --help, -h
    Show this message

More Examples

You can learn almost everything there is to know about runfile from the examples.

You can get any of these examples directly in your terminal by running:

$ run example --help

Documentation

For a more formal documentation, see the User Guide.

Breaking Changes in 1.0.0

Show section

If you are using a version earlier than 1.0, note that version 1.0.0 includes some breaking changes. You can read more about them in this Pull Request.

Upgrading to 1.0.0

No more .runfile config

If you have used the multi-runfile config file, this no longer exists. Use a standard runfile instead, along with the import directive.

No more action :global

If you have used the action :global do notation, this is replaced with the simpler use action do instead. Also, there is no more need for empty usage '', just delete it if you have it in your runfiles.

No more execute directive

If you have used it to cross-call other actions, it is no longer available. As an alternative, you can define common code in separate classes and require them, or use the new helpers directive to define functions that will be available to all actions.

Code outside of actions should be inside helpers

If your runfiles include other ruby code, especially def method, you should now use the new helpers block and tuck this code inside it.

No more need for trap(:INT)

If your old runfiles trap the Interrupt signal, there is no longer a need to do so, as it is trapped by default.

Colsole is included

If your runfiles required and include Colsole, there is no longer a need to do it. Colsole is bundled and available in actions.

Long flags before short flags

This is a cosmetic change for consistency. All generated output shows long flags before short flags --force, -f instead of -f, --force. Update your custom usage directives accordingly.

Examples no longer add implicit 'run'

If you were using the example directive, it will no longer add the initial run in front of your examples. Add it yourself. This is intended to allow providing more elaborate examples.

RunfileTasks

The runfile-tasks gem is also updated to 1.x, with a modified syntax. If you are using it, make sure to upgrade it as well.

Contributing / Support

If you experience any issue, have a question or a suggestion, or if you wish to contribute, feel free to open an issue.

More Repositories

1

bashly

Bash command line framework and CLI generator
Ruby
2,099
star
2

victor

Ruby SVG Image Builder
Ruby
334
star
3

FlicFlac

Tiny portable audio converter for Windows (WAV FLAC MP3 OGG APE M4A AAC)
AutoHotkey
212
star
4

completely

Generate bash completion scripts using a simple configuration file
Ruby
105
star
5

madness

Instant Markdown Server
Ruby
85
star
6

alf

Bash Alias Generator and Manager
Shell
70
star
7

Gridy

Snap Windows to Grid
AutoHotkey
61
star
8

php-quandl

Easy access to the Quandl Data API using PHP
PHP
54
star
9

snapcrawl

Crawl a website and take screenshots
Ruby
52
star
10

kojo

Command line utility for generating config files from templates and definition files
Ruby
51
star
11

lightly

Ruby file cache for performing heavy tasks, lightly.
Ruby
38
star
12

rush

Personal Package Manager - run your GitHub hosted scripts, locally.
Shell
37
star
13

icodi

Deterministic Random SVG Icon Generator
Ruby
31
star
14

secret_hub

Manage GitHub secrets with support for bulk operations and organization secrets
Ruby
27
star
15

minichart

Create SVG mini charts with Ruby
Ruby
24
star
16

approvals.bash

Bash Interactive Approval Testing
Shell
24
star
17

fuzzycd

Change directories with fuzzy search
Shell
23
star
18

pretty_trace

Love Your Ruby's Backtrace
Ruby
16
star
19

webcache

Hassle-free caching for HTTP download with ruby
Ruby
16
star
20

quandl

Go library for accessing Quandl API
Go
15
star
21

opcode

Local Command Shortcuts
Shell
14
star
22

pundit_extra

Extensions and helpers for Pundit
Ruby
14
star
23

docker-madness

Docker Image for the Madness Markdown Server
Ruby
14
star
24

audio_addict

AudioAddict Command Line for Voting and Playlist Management
Ruby
7
star
25

docker-borg-client

Borg Backup Client Docker on Alpine
Dockerfile
7
star
26

jobly

Compact job server with API, CLI, Web UI and a Sidekiq heart
Ruby
6
star
27

rush-repo

My package repository for the Rush package manager
Shell
6
star
28

gondl

Command line console for Quandl
Go
6
star
29

eclipse

Encrypt / Decrypt any text with a simple hotkey
AutoHotkey
6
star
30

concode

Generate consistent-codenames from any string (Heroku style, aka Haiku).
Ruby
6
star
31

git-changelog

Create a changelog from your git repository
Shell
6
star
32

fredric

Federal Reserve Economic Data (FRED) API Library and Command Line
Ruby
5
star
33

menu_commander

Create menus for any command line tool using simple YAML configuration
Ruby
5
star
34

extended_yaml

Ruby YAML with support for including and merging additional YAML files
Ruby
5
star
35

victor-cli

Command line for Victor, the Ruby SVG library
Ruby
5
star
36

apicake

Build Dynamic API Wrappers
Ruby
5
star
37

filecache

Go File Cache
Go
5
star
38

recode

Command line refactoring utility
Ruby
5
star
39

github-redirector

Source code for get.dannyb.co
Ruby
4
star
40

docker-alpine-ruby

Minimal Ruby docker image with native extensions support
Dockerfile
4
star
41

alf-conf

My alf config
Shell
4
star
42

docker-snapcrawl

Crawl a website and take screenshots (Docker version)
Dockerfile
4
star
43

shell-action-example

Run GitHub-hosted shell scripts inside GitHub Actions
Shell
4
star
44

sting

Minimal, lightweight, multi-YAML settings library
Ruby
4
star
45

WallpaperRandomizer

System Tray Wallpaper Changer
AutoHotkey
4
star
46

my-github

Comprehensive index of my open source projects on GitHub
HTML
4
star
47

bashly-book

Source for bashly.dannyb.co
Shell
4
star
48

rigit

Scaffolding that doesn't bite
Ruby
4
star
49

docker-sshd

Alpine SSH Client and Server
Shell
4
star
50

bobkit

Site Generation Toolkit with Slim, SCSS, CoffeeScript and Markdown
Ruby
4
star
51

slacktail

Command line utility for following your Slack chat from the terminal
Ruby
4
star
52

erbx

ERB Extended with Pretty Tags
Ruby
4
star
53

redirectly

Redirect server with dynamic URL and hostname support
Ruby
4
star
54

madman

The Markdown Swiss Army Knife
Ruby
3
star
55

loadrunner

GitHub Webhook Server and Event Simulator
Ruby
3
star
56

experiments

GitHub Experiments
3
star
57

httpme

Static files web server with basic authentication
Ruby
3
star
58

colsole

Utility functions for colorful console applications with Ruby
Ruby
3
star
59

TinySpeech

Portable system tray utility for Windows that adds a global hotkey for speaking any selected text using the default (SAPI) Windows Text-to-Speech.
AutoIt
3
star
60

rspec_approvals

Interactive Approval Testing for RSpec
Ruby
3
star
61

requires

Require all files in a directory
Ruby
3
star
62

mister_bin

Build modular command line tools
Ruby
3
star
63

docker-mdbook

Docker with mdbook
Dockerfile
2
star
64

voicemaker

Create Text to Speech files with the Voicemaker API from Ruby or the command line
Ruby
2
star
65

bootstrap

My personal Ubuntu bootstrap metascript
Shell
2
star
66

echo-webserver

A web server that echoes the request back
Ruby
2
star
67

clipper

Pure Command Line Arguments Parser
Crystal
2
star
68

docker-ruby-python

Docker Alpine with Ruby and Python 2+3
Dockerfile
2
star
69

getcomments

Extract Comments from Ruby Code
Ruby
2
star
70

eod

EOD Historical Data API Library and Command Line
Ruby
2
star
71

favicon.sh

Favicon generator
Shell
2
star
72

docker-alpine-mongo

Docker Alpine MongoDB Image
Dockerfile
2
star
73

docker-alpine-php

Docker PHP CLI Image based on Alpine
Dockerfile
2
star
74

colorly

Command Line Color Palette Generator
Ruby
2
star
75

sector-seven-builder

Static site generator for sector-seven.com
SCSS
2
star
76

docker-rush-sandbox

Docker sandbox for experimenting with Rush CLI
Dockerfile
2
star
77

docspec

Inline tests in Markdown documents
Ruby
2
star
78

docker-ruby-git-compose

Alpine with Ruby, Git, Docker and Docker Compose
Shell
1
star
79

stress-server

Docker image for simulating server resource stress
Ruby
1
star
80

super_docopt

docopt-based command line utility builder
Ruby
1
star
81

intrinio

Library and command line interface for Intrinio data API
Ruby
1
star
82

hash_cabinet

File-based, key-object store with hash-like access.
Ruby
1
star
83

docker-alpine-ruby-mongo

Docker image with ruby and mongo tools based on Alpine
Dockerfile
1
star
84

action-test

Testing the authoring process of GitHub actions
Shell
1
star
85

docker-redirector

HTTP Redirector Docker Image
Ruby
1
star
86

clicumber

Cucumber step definitions for testing command line applications
Ruby
1
star
87

docker-zsh

ZSH on Alpine for testing ZSH related scripts
Shell
1
star
88

pobject

Automatically persist objects to disk as YAML files
Ruby
1
star
89

docker-ruby-php

Alpine image with Ruby and PHP CLI
Dockerfile
1
star
90

docker-gotty

Docker image with Browser Based Linux Terminal
Dockerfile
1
star
91

sasstool

Sass (SassC) command line renderer with globbing import support.
Ruby
1
star
92

dcind

Docker Compose in Docker
Dockerfile
1
star
93

umagick

ImageMagick command line wrapper for running scripts with arguments
Shell
1
star
94

docker-whoami

Whoami Debug Webserver Docker Image
Dockerfile
1
star
95

respec

RSpec Convenience Wrapper
Shell
1
star
96

bashly-support

Support code snippets for bashly
Shell
1
star
97

docker-nikto

Nikto vulnerability scanner docker image
Shell
1
star
98

docker-fallback

Default Ingress Backend
Ruby
1
star
99

actions-debug

Debug GitHub Actions workflow configuration
Ruby
1
star
100

yamlcon

YAML Configuration File Loader
Ruby
1
star