Package command provide simple API to create modern command-line interface

Related tags

Command Line command
Overview

Package command

Package command provide simple API to create modern command-line interface, mainly for lightweight usage, inspired by cobra

Usage

package main

import (
	"fmt"
	"os"

	"github.com/chenen3/command"
)

func main() {
	// Initial root command
	root := &command.Command{
		Name: "root", // change this to actual project name
		Desc: "example description of root command",
		Do: func(self *command.Command) {
			self.Help()
		},
	}

	// Add sub command
	versionCmd := &command.Command{
		Name: "version",
		Desc: "print version",
		Do: func(_ *command.Command) {
			fmt.Println("version v0.1-beta")
		},
	}
	root.AddCommand(versionCmd)

	// Execute root command
	err := root.Execute()
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}

Example output

$ go run main.go
example description of root command

Usage:
  root [flags]
  root [command]

Commands:
  version    	print version

Flags:
  -help
    	help for root

Use "root [command] --help" for more information about a command.
$ go run main.go version
version v0.1-beta
Owner
chenen
chenen
🚀 goprobe is a promising command line tool for inspecting URLs with modern and user-friendly way.

goprobe Build go build -o ./bin/goprobe Example > goprobe https://github.com/gaitr/goprobe > cat links.txt | goprobe > echo "https://github.com/gaitr/

null 3 Oct 24, 2021
Sipexer - Modern and flexible SIP (RFC3261) command line tool

sipexer Modern and flexible SIP (RFC3261) command line tool. Overview sipexer is

Daniel-Constantin Mierla 120 Jun 25, 2022
kcli: command line interface tool to interact with K8trics API server as well as manage its lifecycle

K8trics CLI (kcli) kcli is command line interface tool to interact with K8trics API server as well as manage its lifecycle. kcli can provision and dep

null 3 Dec 15, 2021
A command-line interface for the Riak database through its HTTP API

Riakg Description Is a development oriented command line tool that enables navigation on buckets, keys and values of a Riak KV data store using it's H

cristian 4 May 10, 2022
Inotify-tools is a C library and a set of command-line programs providing a simple interface to inotify.

inotify-tools This is a package of some commandline utilities relating to inotify. The general purpose of this package is to allow inotify's features

null 2.6k Jun 22, 2022
bluemonday-cli is a simple command-line interface to bluemonday

bluemonday-cli bluemonday-cli is a simple command-line interface to bluemonday. We've configured bluemonday for ROVR's specific requirements. It reads

ROVR Labs 0 Jan 24, 2022
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

asciigraph Go package to make lightweight ASCII line graphs ╭┈╯. Installation go get github.com/guptarohit/asciigraph Usage Basic graph package main

Rohit Gupta 2k Jun 23, 2022
A modern UNIX ed (line editor) clone written in Go

ed (the awesome UNIX line editor) ed is a clone of the UNIX command-line tool by the same name ed a line editor that was nortorious for being and most

James Mills 45 May 29, 2021
An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Clement Sam 2k Jun 25, 2022
A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

null 0 Nov 22, 2021
A command line tool to prompt for a value to be included in another command line.

readval is a command line tool which is designed for one specific purpose—to prompt for a value to be included in another command line. readval prints

Venky 0 Dec 22, 2021
Command Line Interface for Terraform Enterprise/Cloud ( tecli )

In a world where everything is Terraform, teams use Terraform Cloud API to manage their workloads. TECLI increases teams productivity by facilitating such interaction and by providing easy commands that can be executed on a terminal or on CI/CD systems.

Amazon Web Services - Labs 199 Jun 27, 2022
FireFly Command Line Interface (CLI)

FireFly CLI The FireFly CLI can be used to create a local FireFly stacks for offline development of blockchain apps. This allows developers to rapidly

Kaleido 1 Mar 1, 2022
a command line interface to orbit.love

orbit-cli NAME: orbit-cli - a command line interface to orbit.love USAGE: orbit-cli [global options] command [command options] [arguments...]

Geoffrey Huntley 4 May 18, 2021
Lux is a command-line interface for controlling and monitoring Govee lighting strips built in Go.

What is Lux? Lux is a command-line interface for controlling and monitoring Govee lighting strips built in Go. Lux provides it's users with the abilit

BanDev 41 Jun 18, 2022
FireFly Command Line Interface (CLI)

FireFly CLI The FireFly CLI can be used to create a local FireFly stacks for offline development of blockchain apps. This allows developers to rapidly

null 34 Jun 16, 2022
Command line interface for flomo.

flomo-cli A Golang based command line interface of flomo. 中文说明 Features Type and save to flomo using command line. Editor mode supports, able to use v

Eason Yang 14 May 17, 2022
Gofire 🔥 Command Line Interface Generator tool for Go

Gofire ?? : Command Line Interface Generator tool for Go Introduction Gofire is the tool for Go that automatically generates a command line interface

Kostiantyn Masliuk 107 May 18, 2022
Command line interface for control iTunes

iTunes CLI Command line interface for control iTunes Description You can control iTunes operations from command line. Equipments macOS Sierra or later

ktr 16 May 16, 2022