Skip to content

A simple Ruby CLI template using Thor and other useful tools

Notifications You must be signed in to change notification settings

omgreenfield/ruby-cli-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This template is for building a Ruby CLI using Thor and some other goodies:

  • An extension (omg-thor-ext) to make Thor behave more like other CLIs (see Matt Brictson's blog about it)
  • Helper scripts
    • bin/install: installs dependencies and copies .env.example to .env
    • bin/console: runs a pry console with everything in src loaded
    • bin/cli: loads up the CLI

(1) Create new repo from template

gh repo create your-name/your-new-cli-repo --public --template=omgreenfield/ruby-cli-template

(2) Preparation

Go through Gemfile and uncomment gems you want to include

(3) Installation

bin/install

(3) Usage

bin/console
bin/cli help

(3.1) Example

# Just the 1 required argument
bin/cli example "required arg"

# The 1 required argument and 1 optional argument
bin/cli example "required arg" "optional arg"

# The 1 required argument, 1 optional argument, and some named args
bin/cli example "required arg" "optional arg" -s "named string" -n 123 -b

(4) Testing

rspec
# or
bundle exec rspec

About

A simple Ruby CLI template using Thor and other useful tools

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published