Documentation ¶
Overview ¶
Gen provides a rudimentary code generator for app. It reads a json definition of a hierarchy of commands and outputs a go file containing generated - commands with their input and output structs - the command hierarchy in go code enriched with the above. The go package is always 'cmd' The following rules apply: - commands that have sub-commands do not have input / output structs and run function generated - an input struct or run function that is specified in the json spec is not generated as the generator assumes it already exists. - a 'base' name is generated for each command by concatenating names in the json path (for example the command add / stuff generates a base name addStuff) - inputs are named baseIn - outputs are named baseOut - run functions are named runBase - some fields are ignored: - pre and post functions - Annotations - Aliases - SuggestFor - ValidArgs - ArgAliases - SuggestionsMinimumDistance The command accepts a single mandatory argument: the path to the json spec and always outputs its result to stdout.
Click to show internal directories.
Click to hide internal directories.