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

akutz / gotopt
69%
master: 69%

Build:
Build:
LAST BUILD BRANCH: feature/usage
DEFAULT BRANCH: master
Repo Added 23 Jan 2016 01:39AM UTC
Files 6
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

LAST BUILD ON BRANCH feature/usage
branch: feature/usage
CHANGE BRANCH
x
Reset
  • feature/usage
  • feature/coveralls
  • feature/gnu-w
  • feature/gotopt
  • feature/privatize-ordering
  • feature/refactor-logrus
  • master

pending completion
65

push

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

121 of 121 new or added lines in 1 file covered. (100.0%)

755 of 1088 relevant lines covered (69.39%)

0.69 hits per line

Relevant lines Covered
Build:
Build:
1088 RELEVANT LINES 755 COVERED LINES
0.69 HITS PER LINE
Source Files on feature/usage
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
65 feature/usage 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 := NewP... push 09 Feb 2016 05:27PM UTC akutz travis-ci pending completion  
61 feature/usage 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. push 09 Feb 2016 05:21PM UTC akutz travis-ci pending completion  
See All Builds (51)
  • Repo on GitHub
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

© 2025 Coveralls, Inc