# README
package cliz
Usage
import (
"log"
cliz "github.com/kunitsucom/util.go/exp/cli"
)
func main() {
cmd := &cliz.Command{
Name: "my-cli",
Description: "My awesome CLI tool",
Usage: "my-cli [options] <subcommand> [arguments...]",
Options: []Option{
&BoolOption{
Name: "version",
Short: "v",
Description: "show version",
Default: Default(false),
},
},
SubCommands: []*Command{
{
Name: "sub-cmd",
Description: `My awesome CLI tool's sub command.`,
},
},
}
called, remaining, err := cmd.Parse(os.Args[1:])
if err != nil {
if errors.Is(err, cliz.ErrHelp) {
return
}
log.Fatalf("failed to parse command line arguments: %+v", err)
}
// ...
}
# Functions
Default is the helper function to create a default value.
No description provided by the author
IsHelp returns whether the error is ErrHelp.
No description provided by the author
# Constants
HelpOptionName is the option name for help.
# Variables
DebugLog is the logger to be used for debug log.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Stderr is the writer to be used for standard error.
Stdout is the writer to be used for standard output.
TraceLog is the logger to be used for trace log.
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author