Git-Like Interface Command Line Parser

GLI is the best way to make a “command-suite” command-line application, e.g. one like git (for the best way to make a simpler command-line application, check out methadone).

GLI allows you to make a polished, easy-to-maintain command-line application without a lot of syntax, but without restricting you in any way from the power of OptionParser.

Build Status

Use

Install if you need to:

gem install gli

The simplest way to get started is to create a scaffold project

gli init todo list add complete

This will create a basic scaffold project in ./todo with:

Now, you are ready to go:

> cd todo
> bundle exec bin/todo help
NAME
    todo - Describe your application here

SYNOPSIS
    todo [global options] command [command options] [arguments...]

VERSION
    0.0.1

GLOBAL OPTIONS
    -f, --flagname=The name of the argument - Describe some flag here (default: the default)
    --help                                  - Show this message
    -s, --[no-]switch                       - Describe some switch here

COMMANDS
    add      - Describe add here
    complete - Describe complete here
    help     - Shows a list of commands or help for one command
    list     - Describe list here

> bundle exec bin/todo help list
NAME
    list - Describe list here

SYNOPSIS
    todo [global options] list [command options] Describe arguments to list here

COMMAND OPTIONS
    -f arg - Describe a flag to list (default: default)
    -s     - Describe a switch to list

All you need to do is fill in the documentation and your code; the help system, command-line parsing and many other awesome features are all handled for you.

Get a more detailed walkthrough on the main site

Supported Platforms

Known to work on

If you’re interested in other versions of Ruby, let me know, and I’ll add them to my test suite

Documentation

Extensive documentation is available at the wiki.

API Documentation is available here. Recommend starting with GLI::DSL or GLI::App.

Credits

Author

Dave Copeland (davetron5000 at g mail dot com)

Copyright

Copyright © 2010 by Dave Copeland

License

Distributes under the Apache License, see LICENSE.txt in the source distro

gli CLI documentation

gli - create scaffolding for a GLI-powered application

v2.2.1

Global Options

-r|–root arg

Root dir of project

Default Value

.

This is the directory where the project”s directory will be made, so if you specify a project name ”foo” and the root dir of ”.”, the directory ”./foo” will be created’

–help

Show this message

-n

Dry run; dont change the disk

-v

Be verbose

–version

Commands

Command: help command

Shows a list of commands or help for one command

Gets help for the application or its commands. Can also list the commands in a way helpful to creating a bash-style completion function

Options
-c

List commands one per line, to assist with shell completion

Command: init|scaffold project_name [command[ command]*]

Create a new GLI-based project

This will create a scaffold command line project that uses GLI for command line processing. Specifically, this will create an executable ready to go, as well as a lib and test directory, all inside the directory named for your project

Options
-e|–ext

Create an ext dir

–[no-]force

Overwrite/ignore existing files and directories

–notest

Do not create a test or features dir

–[no-]rvmrc

Create an .rvmrc based on your current RVM setup