gen

command
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2023 License: MIT Imports: 7 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL