Sha256: 1cc413a0b990835a64244c747277950daf427922b526a6d5a100a0146d483474

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

= Method Missing "Auto" Usage

Require Commandline library.

    require 'clio/commandline'
    $0 = 'test'

Handles a toplevel option using method_missing.

    cli = Clio::Commandline.new('--verbose')
    cli.verbose?
    cli.to_s.assert == 'test [--verbose]'

Handles a toplevel option with aliases using method_missing.

    cli = Clio::Commandline.new('--verbose')
    cli.verbose?(:v)
    cli.to_s.assert == 'test [-v --verbose]'

Returns a toplevel option value"

    cli = Clio::Commandline.new('--verbose')
    cli.verbose?(:v).assert == true

Create new commandline object.

    cmd = Clio::Commandline.new('--verbose')
    cmd.usage.command('foo')
    cmd.parse

== Single Character Option

Create new Commandline object.

    @cmd = Clio::Commandline.new('-V')

Returns a toplevel option value.

    @cmd.verbose?(:V).assert == true

== Option Literal Shorthand

An option and a subcommand parsed statically.

    $0 = 'test'
    @cli = Clio::Commandline.new('-V foo')
    @cli.usage.opt('--verbose -V')
    @cli.usage.command('foo')
    @cli.parse

Parses the option correctly.

    @cli.options[:verbose].assert == true

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clio-0.3.0 spec/commandline/autousage.rd