GitXplorerGitXplorer
S

nice

public
209 stars
8 forks
0 issues

Commits

List of commits on branch master.
Verified
a29cd3367b177355379f030ffe80a79f2f9db440

docs(readme): add packages list into `README.md` (#13)

SSuperPaintman committed 3 years ago
Verified
d50d3d0f67c3cefc50fadddc7a54aa4c933b6af5

ci(codecov): fix `codecov.yml` (#12)

SSuperPaintman committed 3 years ago
Verified
c006255cde568d4ecb3e2ed1049e7b0346c24bc5

ci(codecov): add `codecov.yml` (#11)

SSuperPaintman committed 3 years ago
Verified
5678e28460e0cb5f9b621b82e0eb8d42e8eff510

ci(github): add jobs for building examples (#10)

SSuperPaintman committed 3 years ago
Verified
34f17d7a51ee2832c1d9160f680f8fe9477da09e

docs(cli): add Go docs for the generated code (#9)

SSuperPaintman committed 3 years ago
Verified
5a43d19e63381e5888c63855f3affb3c1f0422f2

docs(examples): add more examples (#8)

SSuperPaintman committed 3 years ago

README

The README file for this repository.

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


Table of Contents


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 "github.com/SuperPaintman/nice/cli"

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

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

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

	app.HandleError(app.Run())
}

Now you can run it!

$ go run . world

Or print the help for your app:

$ go run . -h

Help example


Examples

You can find more examples in the ./examples directory.


Packages

🖥️ github.com/SuperPaintman/nice/cli

DocumentationSource

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

🖌️ github.com/SuperPaintman/nice/colors

DocumentationSource

import "github.com/SuperPaintman/nice/colors"

Tests

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

Similar projects


License

MIT


With 🫀 by Aleksandr Krivoshchekov (@SuperPaintman)