Blocking CMD shell interaction tool.

CliToolkit

Go Report Card Lines of code GitHub go.mod Go version
Blocking command line shell interaction tool.

CliToolkit is a small cmd package for Go cmd shell interaction application.

Installation

# download from github
go get github.com/tianyagk/CliToolkit

Using the ClikToolkit Library

Create CliToolkit

Initial your interaction app with CliToolkit:

// Init and Setup Command Client with Function Mapper
CommandClient := CliToolkit.Command{
		Use:    "DefaultApp",
		Intro:  "CliToolkit Application",
		Short:  "Hello, welcome CliToolkit by Golang",
		Long:   "long:",
		Prompt: ">> ",
	}

FuncMap := make(map[string]CliToolkit.Event)
FuncMap["echo"] = CliToolkit.Event{DoFunc: echo, Description: "Repeat input string", Flag: "-echo", ErrorHandler: CliToolkit.DefaultErrorHandler}

CommandClient.FuncMap = FuncMap
CommandClient.Run()

// Define your command func here
func echo(str string, _ CliToolkit.Command) error {
	fmt.Println(str)
	return nil
}

You will additionally define the command function and ErrorHandler function into your FuncMap.

Example custom function

Define your own ErrorHandler function for individual command function:

func CustomErrorHandler(err error) {
	if err != nil {
        fmt.Println("Command Error:", err)
	}
}

Contributions

Similar Resources

A shell tool to create counting semaphores, acquire them and release them.

A shell tool to create counting semaphores, acquire them and release them. This is useful if you want to e.g. run no more than N out of M commands in parallel.

Oct 12, 2021

Go Coverage in Shell: a tool for exploring Go Coverage reports from the command line

Go Coverage in Shell: a tool for exploring Go Coverage reports from the command line

Go Coverage in Shell: a tool for exploring Go Coverage reports from the command line

Dec 31, 2022

🧑‍💻📊 Show off your most used shell commands

🧑‍💻📊 Show off your most used shell commands

tsukae 🧑‍💻 📊 Tsukae, 使え - means use in Japanese (so it refers to commands that you use) Built on top of termui and cobra Big shoutout to jokerj40 f

Dec 17, 2022

A goroutine monitor to keep track of active routines from within your favorite shell.

A goroutine monitor to keep track of active routines from within your favorite shell.

roumon A goroutine monitor to keep track of active routines from within your favorite shell. Features Track live state of all active goroutines Termin

Jan 3, 2023

🎀 a nice lil shell for lua people made with go and lua

Hilbish 🎀 a nice lil shell for lua people made with go and lua It is currently in a mostly beta state but is very much usable (I'm using it right now

Jan 3, 2023

Shelby is a fast ⚡️ , lightweight ☁️ , minimal✨, shell prompt written in Go.

Shelby is a fast ⚡️ , lightweight ☁️ , minimal✨,  shell prompt written in Go.

Shelby is a fast ⚡️ ,lightweight ☁️ ,minimal ✨ , shell prompt written in Pure Go. Installation Follow the steps below(Linux and macOS), and Post Insta

Dec 3, 2022

A multiple reverse shell sessions/clients manager via terminal written in go

A multiple reverse shell sessions/clients manager via terminal written in go

Nov 9, 2022

ReverseSSH - a statically-linked ssh server with reverse shell functionality for CTFs and such

 ReverseSSH - a statically-linked ssh server with reverse shell functionality for CTFs and such

ReverseSSH A statically-linked ssh server with a reverse connection feature for simple yet powerful remote access. Most useful during HackTheBox chall

Jan 5, 2023

A spotify shell client in go.

libman Libman is an interactive spotify shell. Features Control your spotify playback. Edit playlists. Fully complies to the spotify web api terms of

Oct 16, 2022
`tmax` is a powerful tool to help you get terminal cmd directly.
`tmax`  is a powerful tool to help you get terminal cmd directly.

The positioning of tmax is a command line tool with a little artificial intelligence. If you frequently deal with the terminal daily, tmax will greatly improve your work efficiency.

Oct 15, 2022
all-in-one cmd tool to search man page of different platform

Overview remote-man is an all-in-one cmd tool to search man page of different platform. support search platform Linux MacOS FreeBSD Installation compi

Oct 31, 2022
It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`

It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`. It's a makefile alternative and a shell wrapper.

Oct 18, 2022
painless task queue manager for shell commands with an intuitive cli interface (execute shell commands in distributed cloud-native queue manager).

EXEQ DOCS STILL IN PROGRESS. Execute shell commands in queues via cli or http interface. Features Simple intuitive tiny cli app. Modular queue backend

Dec 14, 2022
ap 是一个 shell 工具,可以让其它 shell 命令的输出能够自动进入交互翻页模式

ap -- auto-pager ap 是一个 shell 工具,可以让其它 shell 命令的输出能够自动进入交互翻页模式。 ap 由两部分组成,一个 Go 语言编写的二进制程序,负责捕获命令的输出并支持翻页, 和一组 shell 脚本,负责为用户指定的命令清单创建与之同名的 wrapper。 经

Apr 12, 2022
Todo-cmd: an app you can add your tasks , edit or delete them

TODO CMD APP! ??‍♂️ Table of contents General info Update Requirements set-up usage General info todo-cmd is an app you can add your tasks , edit or d

Dec 13, 2021
Go cmd utility that prints its command line arguments using strings.Join

Results This is an exercise of the book The Go Programming Language, by Alan A. A. Donovan and Brian Kernighan. Comparison between different versions

Dec 18, 2021
Gostall - Run go install ./cmd/server and not have the binary install in your GOBIN be called server?

GOSTALL Ever wanted to run go install ./cmd/server and not have the binary insta

Jan 7, 2022
A simple library to build golang command line (cli / cmd)apps

A simple library to build golang command line (cli / cmd)apps

Jan 11, 2022
Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.
Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.

Sampler. Visualization for any shell command. Sampler is a tool for shell commands execution, visualization and alerting. Configured with a simple YAM

Dec 28, 2022