Categorygithub.com/artziel/go-console
modulepackage
1.0.8
Repository: https://github.com/artziel/go-console.git
Documentation: pkg.go.dev

# README

Golang Console

artziel Narvaiza [email protected]

Features

  • Allow use of sub command

Use example:

package main

import (
	"fmt"
	"os"

	GoConsole "gitlab.com/artziel/go-console"
)

type SubCommandAFlags struct {
	String  string `GoConsole:"name:str,usage:String value example"`
	Boolean bool   `GoConsole:"name:b,usage:Boolean value example"`
	Integer int    `GoConsole:"name:i,usage:Integer value example"`
}

func main() {
	root := GoConsole.Root{
		Commands: map[string]GoConsole.Command{
			"": {
				Help:    "Main Command",
				Example: "$ sample",
				Flags: &SubCommandAFlags{
					String:  "test.yaml",
					Boolean: false,
					Integer: 123,
				},
				Run: func(args interface{}) error {
					flags := args.(*SubCommandAFlags)
					fmt.Printf("Main Command - Args: %v\n", flags)
					return nil
				},
			},
			"SubCommandA": {
				Help:    "SubCommand A",
				Example: "$ sample SubCommandA",
				Flags: &SubCommandAFlags{
					String:  "test.yaml",
					Boolean: false,
					Integer: 123,
				},
				Run: func(args interface{}) error {
					flags := args.(*SubCommandAFlags)
					fmt.Printf("SubCommand A - Args: %v\n", flags)
					return nil
				},
			},
		},
	}

	if err := root.Run(os.Args[1:]); err != nil {
		fmt.Println(err.Error())
	}
}

# Packages

No description provided by the author

# Functions

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
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
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

# Constants

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
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
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
No description provided by the author
No description provided by the author

# Variables

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
No description provided by the author
No description provided by the author

# 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
No description provided by the author
No description provided by the author