The go program will be run as an executable with flags that tell it what it should be doing. The first flag describes what part of the CLI you are targeting (for example the task integration or code parsing). Other flags will describe what piece of functionality you are specifically wanting to run.
To login wth JIRA, you might use a command that looks something like:
raydoc -task -login-jira
Or to initialize a project at a path, you might run:
raydoc -config -initialize-project
- Set up the API keys
- Set up the python API
Handling of the commands is performed through the commands map. You should either add your functionality to an existing group or create a new group. All code execution beyond basic parsing of the command should be performed through handlers as defined in the map.
The handlers must be of type func(*flag.FlagSet).
You can use the values passed in with the flags by using the flags.Lookup("<flag>").Value.String(). You can then convert it:
- To int:
number, err := strconv.Atoi(flags.Lookup("number").Value.String()) - To bool:
boolean, err := strconv.ParseBool(flags.Lookup("boolean").Value.String())