Command-Line Argument Sorting and Parsing, for Go
CLASP stands for Command-Line Argument Sorting and Parsing. The first CLASP library was a C library with a C++ wrapper. There have been several implementations in other languages. CLASP.Go is the Go version.
Install via go get, as in:
go get "github.com/synesissoftware/CLASP.Go"and then import as:
import clasp "github.com/synesissoftware/CLASP.Go"or, simply, as:
import "github.com/synesissoftware/CLASP.Go"All CLASP libraries discriminate between flags, options, and values. CLASP.Go provides types and functions to specify arguments (Flag(), Option(), Section(), …), parse the command line (Parse()), and inspect the results (Argument, Arguments).
Specification describes each command-line element (name, aliases, help, value sets, bit-flags receivers). See EXAMPLES.md for worked examples.
ShowUsage() and ShowVersion() display help and version information and may terminate the process. Standard --help and --version specifications are available via HelpFlag() and VersionFlag().
const (
VersionMajor uint16 = /* ... */
VersionMinor uint16 = /* ... */
VersionPatch uint16 = /* ... */
VersionAB uint16 = /* ... */
)
func Version() uint64
func VersionString() stringExamples are provided in the examples directory, along with a markdown description for each. A detailed list TOC of them is provided in EXAMPLES.md.
Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/CLASP.Go.
CLASP.Ruby is inspired by the C/C++ CLASP library, which is documented in the articles:
- An Introduction to \CLASP, Matthew Wilson, CVu, January 2012;
- Anatomy of a CLI Program written in C, Matthew Wilson, CVu, September 2012; and
- Anatomy of a CLI Program written in C++, Matthew Wilson, CVu, September 2015.
Other CLASP libraries include:
Projects in which CLASP.Go is used include:
CLASP.Go is used in the libCLImate.Go library.
CLASP.Go is released under the 3-clause BSD license. See LICENSE for details.