Skip to content

Development

Valter Silva edited this page Oct 13, 2020 · 2 revisions

Commands

CLENCLI uses Cobra. Cobra is built on a structure of commands, arguments & flags.

Commands represent actions, Args are things and Flags are modifiers for those actions.

The best applications will read like sentences when used. Users will know how to use the application because they will natively understand how to use it.

The pattern to follow is:

APPNAME VERB NOUN --ADJECTIVE

In clencli's case, all commands should follow this pattern:

clencli COMMAND ARG --FLAG

In other words:

COMMAND should be a VERB. ARG is a NOUN. And FLAG is an adjective

A few good real world examples may better illustrate this point.

In the following example, 'server' is a command, and 'port' is a flag:

clencli render document --type readme

Debugging

To debug the code using VS Code, please refer to this documentation. You can debug by creating debug tasks and specifying which command you want to debug:

{
  "version": "0.2.0",
  "configurations": [
      {
          "name": "Debug - template --type inputs",
          "type": "go",
          "request": "launch",
          "mode": "debug",
          "program": "${workspaceFolder}/main.go",
          "args": ["template", "--type", "inputs"]
      }
  ]
}

Templates

Templates and databases must be located under clencli/* directory, as <value>.tmpl and <value>.yaml respectively. In the template, the data source db will be provided by default.

Resources

  • Go Text Templates 1

Clone this wiki locally