Giter Club home page Giter Club logo

gli's Introduction

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.

<img src=“https://secure.travis-ci.org/davetron5000/gli.svg?branch=gli-2” alt=“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:

  • executable in ./todo/bin/todo. This file demonstrates most of what you need to describe your command line interface.

  • an empty test in ./todo/test/default_test.rb that can bootstrap your tests

  • an empty feature in ./todo/features/todo.feature that can bootstrap testing your CLI via Aruba.

  • a gemspec shell

  • a README shell

  • Rakefile that can generate RDoc, package your Gem and run tests

  • A Gemfile suitable for use with Bundler to manage development-time dependencies

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

Tests should be passing supported MRI Rubies (see .travis.yml for specifics).

Due to the vagaries of Travis, I can’t keep the test suite running on unsupported Rubies, but we currently support:

  • 2.1

  • 2.2

  • 2.3

  • 2.4

  • JRuby

GLI likely works on older rubies, but the cost of keeping tests passing on those versions (which are now totally unsupported by Ruby core) is too high.

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

:include:gli.rdoc

gli's People

Contributors

aterris avatar aussielunix avatar babysnakes avatar bemurphy avatar blackjid avatar blindgaenger avatar brianknight10 avatar calestar avatar chrisarcand avatar chumpy avatar d1 avatar davetron5000 avatar dblock avatar dividedmind avatar edusantana avatar gnufied avatar gorsuch avatar haegin avatar jacobevelyn avatar jesseherrick avatar johnl avatar kale avatar kiela avatar levinalex avatar olleolleolle avatar pengwynn avatar pschambacher avatar specious avatar tokengeek avatar zeropointenergy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.