• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

akutz / gotopt / 64
69%

Build:
DEFAULT BRANCH: master
Ran 09 Feb 2016 05:27PM UTC
Jobs 1
Files 6
Run time 26min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
64

Pull #7

travis-ci

akutz
Adds Usage functions

This patch adds the ability for a Parser to generate usage text for the
options it will parse. Usage text can be returned as a string or printed
to an io.Writer with or without leading indentation. For example:

    p := NewParser()
    p.Opt('n', "name", NoArgument, "",
        "A flag indicating the name is a trailing arg")
    p.Opt('t', "time", RequiredArgument, "epoch", "The epoch")
    p.Opt('x', "xist", OptionalArgument, "val",
        "A value with the answer to our existence")
    p.Opt(0, "play", NoArgument, "", "Whether or not it's time to play")
    p.Opt(0, "fast", OptionalArgument, "mph", "How fast to go")
    p.Opt(0, "slow", RequiredArgument, "mph", "How slow to go")
    p.Opt('h', "", RequiredArgument, "00-23", "The current hour")
    p.Opt('o', "", OptionalArgument, "asc|desc", "The current order")
    p.Opt('z', "", NoArgument, "",
        "Drop the zero, and get with the hero")

p.PrintUsage(os.Stdout)

The above snippet will emit the following to Stdout:

        -n, --name       A flag indicating the name is a trailing arg
        -t, --time epoch The epoch
        -x, --xist [val] A value with the answer to our existence
            --play       Whether or not it's time to play
            --fast [mph] How fast to go
            --slow mph   How slow to go
        -h 00-23         The current hour
        -o [asc|desc]    The current order
        -z               Drop the zero, and get with the hero
Pull Request #7: Adds Usage functions

755 of 1088 relevant lines covered (69.39%)

0.69 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
74
100.0
gotopt.go
Jobs
ID Job ID Ran Files Coverage
1 64.1 09 Feb 2016 05:27PM UTC 0
69.39
Travis Job 64.1
Source Files on build 64
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #64
  • Pull Request #7
  • PR Base - master (#60)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc