Skip to content

Yet another getopt implementation for golang

License

Notifications You must be signed in to change notification settings

gdamore/optopia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optopia™

Build Status Coverage Code Quality GoDoc Apache 2.0 License

Optopia is a simple utility library for parsing options, much in the style of getopt() or getopt_long(), but for Go programs.

Why yet another getopt clone?

We needed some basic functionality with easy callbacks that could be used disconnected from an application (so that we could create individual instances of an application to facilitate testing.) It wasn’t immediately obvious that any of the usual suspects met that need.

There are many other option parsers that offer more richness. Please feel free to use those if that’s what you’re looking for; we’ve aimed for simplicity.

Note that some option parsers work by using reflection and structure tags. We find that a bit obtuse, and difficult to use. Such approaches also bypass the good type validation that Go gives us, so we “opt” (pardon the pun) to let the language help us.

Documentation

For docs, see https://godoc.org/gdamore/optopia or run:

$ godoc -http=:6060

Dependencies

None, apart from things found in the standard library. Optopia should be portable to any platform Go runs on.

Testing

This package supports internal self tests, which can be run in the idiomatic Go way. At present the code is completely covered by the test suite.


Copyright 2019 Garrett D’Amore

About

Yet another getopt implementation for golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages