cli

package module
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 5 Imported by: 0

README

Callamary CLI

A simple CLI package for Golang project


. Report Bug . Request Feature

Build Status Downloads Contributors Issues License


Simple CLI Package for Go Projects

This CLI package is designed to facilitate the integration of command-line interface (CLI) capabilities into Go projects, streamlining the process of implementing CLI commands.

How to use

Assuming that your CLI commands are located in a commands directory, you can utilize the package as follows:

/* commands/main.go */

func main() {

  cli.Command("hello", hello, "Greeting CLI command")
  ...

  cli.Run() // call run function at the bottom
}

func hello() {
  fmt.Println("Hello World")
}

Console Message

Showing message in terminal will be ease. For example you need to print error message in terminal, you can call:

Error
  cli.Error("Error", error)
Warning
  cli.Warning("Warning")
Success
  cli.Success("Success")

Build the commands

For the initial installation, you must manually build your executable by using the following command:

build -o ./call ./commands/main.go

After the executable has been generated, you can simply run

./call build

to incorporate any newly added commands in subsequent updates.

License

Callamary CLI is open-sourced software licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(name string, fn func(), description string)

Register command to be used in cli

func Error

func Error(message string, e error)

Print error message

func Run

func Run()

func Success

func Success(message string)

Print success message

func Warning

func Warning(message string)

Print warning message

Types

This section is empty.

Jump to

Keyboard shortcuts

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