Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foxcapades/argonaut
Builder style CLI creation kit.
https://github.com/foxcapades/argonaut
api cli command-line golang library
Last synced: 9 days ago
JSON representation
Builder style CLI creation kit.
- Host: GitHub
- URL: https://github.com/foxcapades/argonaut
- Owner: Foxcapades
- License: mit
- Created: 2020-04-04T03:42:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-30T02:24:37.000Z (about 1 month ago)
- Last Synced: 2024-10-17T01:18:43.171Z (20 days ago)
- Topics: api, cli, command-line, golang, library
- Language: Go
- Homepage:
- Size: 1.41 MB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 16
-
Metadata Files:
- Readme: readme.adoc
- License: LICENSE
Awesome Lists containing this project
README
= Argonaut
:repo: https://github.com/Foxcapades/Argonaut++++
++++Argonaut is a builder-style CLI creation kit packed with features.
image:https://img.shields.io/github/license/Foxcapades/Argonaut[GitHub]
image:https://img.shields.io/github/v/tag/Foxcapades/Argonaut?label=version[GitHub tag (latest SemVer), link=https://github.com/Foxcapades/Argonaut/releases/latest]
image:https://goreportcard.com/badge/github.com/Foxcapades/Argonaut[link=https://goreportcard.com/report/github.com/Foxcapades/Argonaut]
image:https://img.shields.io/badge/go-docs-blue[Static Badge,link=https://pkg.go.dev/github.com/Foxcapades/Argonaut]
image:https://img.shields.io/badge/wiki-docs-purple[Wiki,link=https://github.com/Foxcapades/Argonaut/wiki][source, go]
----
import (
cli "github.com/Foxcapades/Argonaut"
)
----== Features
* Builder-style API.
+
[source, go]
----
cli.Flag().
WithArgument(cli.Argument().
WithName("file").
Require())
----
* Build singular command applications or command trees.
+
[source, go]
----
cli.Command()
// OR
cli.Tree()
----
* Overridable automatic help text generation.
+
[source, console]
----
Usage:
my-app [options]
This is a simple command tree example.Flags
-h | --help
Prints this help text.Commands
fizz Aliases: fi
This is the description for the fizz branch.
foo Aliases: fo
this is the description for the foo branch
----
* Bind command line arguments to variables of arbitrary types.
+
[source, go]
----
foo := uint8(0)cli.Argument().WithBinding(&foo)
----
* Multi-use flags.
+
[source, console]
----
$ foo --bar --bar --bar
bar = 3
----
* Stackable short flags.
+
[source, console]
----
$ app -abc=4
a = true
b = true
c = 4
----
* Callback hooks.
+
[source, go]
----
cli.Flag().WithCallback(func(Flag){})
cli.Command().WithCallback(func(Command){})
cli.Tree().WithCallback(func(Tree){})
cli.Branch().WithCallback(func(Branch){})
cli.Leaf().WithCallback(func(Leaf){})
----
* Customizable or overridable unmarshalling of almost any type.
+
[source, go]
----
var options argo.UnmarshalProps
...
cli.Argument().WithUnmarshaler(argo.NewMagicUnmarshaler(options))
----
* Default values for flags and arguments.
+
[source, go]
----
var foo int32
cli.Argument().WithBinding(&foo).WithDefault(int32(666))
----
* Input validation hooks.
+
[source, go]
----
var bind uint8
cli.Argument().
WithBinding(&bind)
WithValidator(func(string) {}).
WithValidator(func(string, int8) {})
----
* Automatic capturing of "passthrough" flags and arguments.
+
[source, console]
----
$ foo bar --fizz=buzz -- apple banana canteloupe
Passthroughs: apple, banana, canteloupe
----
* And more!== Examples
. https://github.com/Foxcapades/Argonaut/tree/master/examples/complex-type[Complex Types]
. https://github.com/Foxcapades/Argonaut/tree/master/examples/number-extras[Number Format Extras]
. https://github.com/Foxcapades/Argonaut/tree/master/examples/simple-tree[Simple Tree]