# README
definitions
Definitions is the guts and description of all commands and subcommands
that are used in cf
.
Program Design
Auto-generated Code
It is important to understand the relationship between the definitions.toml
file that resides in the definitions
directory, and the autogenerated.go
file that resides in the cmd
directory.
definitions.toml -- Contains a hand-written definition of each command-line command, their arguments, and their sub-commands.
autogenerated.go -- Contains golang code that does two things. First, it creates all Variables passed to the program using the command-line. Second, it generates the command and subcommand structure of the CLI.
definitions.go - Generates the go code using a series of templates. It is not pretty at all, but it converts the toml to definitions of cobra, which provides a robust framework for CLI tools.
Where are the API calls made?
cmd/root.go
has a large switch-statement where all API calls to cloudflare-go
are made.
When necessary, this switch statement does any massaging necessary to
make the arguments from the command line fit in to the expected method signature.