Highly customizable and lightweight Go CLI app framework πŸ‘Œ

Nice πŸ‘Œ

Nice is a highly customizable and lightweight framework for crafting CLI apps.

Nice respects idiomatic Go code and focuses to be clear, efficient and easy to write and maintain.

You can use it as a full-featured non-opinionated framework or use any nice packages as stand-alone libraries.

I hope you'll enjoy your nice CLI app!

Banner


Hello, Nice!

Let's start with your first Nice CLI app.

First, install the framework:

$ go get github.com/SuperPaintman/nice/cli

Then put this code into a file (hello.go for example):

package main

import (
	"log"

	"github.com/SuperPaintman/nice/cli"
)

func main() {
	app := cli.App{
		Name:  "hello",
		Usage: cli.Usage("Print a friendly greeting"),
		Action: cli.ActionFunc(func(ctx cli.Context) cli.ActionRunner {
			name := cli.StringArg(ctx, "name",
				cli.Usage("Who we say hello to"),
				cli.Optional,
			)
			*name = "Nice" // Default value.

			return func(ctx cli.Context) error {
				ctx.Printf("Hello, %s!\n", *name)

				return nil
			}
		}),
		CommandFlags: []cli.CommandFlag{
			cli.HelpCommandFlag(),
			cli.VersionCommandFlag("0.0.0"),
		},
	}

	if err := app.Run(); err != nil {
		log.Fatal(err)
	}
}

Now you can run it!

$ go run . world

Or print the help for your app:

$ go run . -h

Help example


Tests

$ go test ./... -test.short
$ go test ./... -bench=. -benchmem -run='^Benckmark'

Similar projects


License

MIT


With πŸ«€ by Aleksandr Krivoshchekov (@SuperPaintman)

Owner
Aleksandr Krivoshchekov
Lead Software Engineer at @Yandex
Aleksandr Krivoshchekov
Similar Resources

A highly-scalable, entity-resolution technology that was originally developed to connect internal data together

TiloRes CLI What is TiloRes? TiloRes is a highly-scalable, β€œentity-resolution” technology that was originally developed to connect internal data toget

Jun 17, 2022

This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an encoded polyline with the locations found in the log file.

This is a Go Cli app that receives an string path to a log file, and based on it generates  and prints in console an encoded polyline with the locations found in the log file.

GEOENCODE GO CLI APP DESCRIPTION This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an e

Oct 1, 2021

a lightweight and simple cli package

β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–„β–ˆ β–„β–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–€ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–Œ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–Œ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–Œ β–ˆβ–ˆβ–ˆ β–ˆβ–„ β–ˆβ–ˆβ–ˆ

Oct 14, 2021

Simple, lightweight, and easy to use gopacket wrapper cli

gniffer Simple, lightweight, and easy to use gopacket wrapper cli Explore the docs Β» View Demo Β· Report Bug Β· Request Feature Table of Contents About

Dec 25, 2021

Show Languages In Code. A fast and lightweight CLI to generate stats on the languages inside your project

Show Languages In Code. A fast and lightweight CLI to generate stats on the languages inside your project

slic Show Languages In Code. Usage Run it with an -h flag to list all commands. -d flag can be used to specify the directory of search -i flag can be

Dec 25, 2021

simple cli app for search and watch anime

simple terminal app for search and watch movie or anime

Oct 30, 2021

a lightweight CLI client for interacting with the Akash Network

Akash Command Center A lite weight client for communicating with the Akash Network. There are no provider, or validator bits in this project. Install

Feb 12, 2022

Lightweight CLI tool to programmatically rescale your Hetzner virtual server daily to optimize your budget spending

Lightweight CLI tool to programmatically rescale your Hetzner virtual server daily to optimize your budget spending

Nov 28, 2022

CLI - A package for building command line app with go

CLI - A package for building command line app with go

Command line interface Screenshot Key features Lightweight and easy to use. Defines flag by tag, e.g. flag name(short or/and long), description, defau

Dec 23, 2022
Make Highly Customized Boxes for your CLI
Make Highly Customized Boxes for your CLI

Box CLI Maker ?? Box CLI Maker is a Highly Customized Terminal Box Creator. Features Make Terminal Box in 8️⃣ inbuilt different styles 16 Inbuilt Colo

Jan 1, 2023
The extremely customizable and themeable shell prompt.

kitch-prompt Kitch-prompt is a cross-platform tool for displaying a shell prompt, which can be extensively customized both in terms of what is shown,

Dec 28, 2022
Yaf - Yet another system fetch that is minimal and customizable
Yaf - Yet another system fetch that is minimal and customizable

Yaf - Yet Another Fetch [Support] [Installation] [Usage] Brief Yet Another Fetch

Oct 11, 2022
progress_bar creates a single customizable progress bar for Linux terminal.
progress_bar creates a single customizable progress bar for Linux terminal.

progress_bar Go Progress Bar Features progress_bar creates a single customizable progress bar for Linux terminal. Installation go get -u github.com/er

Aug 12, 2022
A cutting edge (haha), prototype, object-oriented and highly modular slash command handler for Discordgo.
A cutting edge (haha), prototype, object-oriented and highly modular slash command handler for Discordgo.

ken ⚠️ Disclaimer This package is still in a very early state of development and future updates might include breaking changes to the API until the fi

Dec 12, 2022
Test-app-url-shortner - A sample url shortener app to test Keploy integration capabilities
Test-app-url-shortner - A sample url shortener app to test Keploy integration capabilities

test-app-url-shortner A sample url shortener app to test Keploy integration capa

Jan 23, 2022
Go-cent-app - CENT.APP GO Package

CENT.APP - GO Package Official documentation - https://cent.app/en/merchant/api

Dec 20, 2022
GTDF-CLI - The official CLI tool to operate with Getting Things Done Framework
GTDF-CLI - The official CLI tool to operate with Getting Things Done Framework

This is the official CLI tool to operate with Getting Things Done Framework. How

Feb 14, 2022
A highly-performant command runtime server written in Go for Flame πŸ”₯

Flame Command Runtime A highly-performant command runtime server written in Go for Flame ?? Flame Command Runtime(FCR) is powerful, highly customizabl

Aug 29, 2021