Skip to content


The main entry point for a Clîr application is the Cli object. This is created using the NewCli command which takes an application name, description and optional version:

package main

import ""
import "log"

func main() {

  // Create the application
  cli := clir.NewCli("Basic", "A basic example", "v0.0.1")

  // Run the application
  err := cli.Run()
  if err != nil {
    // We had an error

When you run this app, you will get the default help text:

> basic
Basic v0.0.1 - A basic example


        Get help on the 'basic' command.


NewCli(name string, description string, version string) *Cli

The NewCli function creates a new Clîr application.

Cli.Run(args ...string) error

The Run method starts the application. By default it will use os.Args, though you are free to pass in arguments for testing purposes. Run returns an error, which may be handled appropriately.