cubefs/vendor/github.com/desertbit/grumble
yuxiaobo ac75137295 build: the build script of blobstore is merged into cubefs
1. rocksdb upgrade to 6.3.6
2. optimize the build scripts
3. fix build errors
4. add env variable for blobstore unit test
5. update git ignore file to ignore build and test result
6. modify open files limit for unit test

Signed-off-by: yuxiaobo <yuxiaobo@oppo.com>
Signed-off-by: slasher <shenjie1@oppo.com>
Signed-off-by: Victor1319 <834863182@qq.com>
2023-05-23 15:24:53 +08:00
..
.gitignore build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
app.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
argmap.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
argopt.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
args.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
AUTHORS build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
command.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
commands.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
completer.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
config.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
context.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
flagmap.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
flags.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
functions.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
grumble.go build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
LICENSE build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00
README.md build: the build script of blobstore is merged into cubefs 2023-05-23 15:24:53 +08:00

Grumble - A powerful modern CLI and SHELL

GoDoc Go Report Card

There are a handful of powerful go CLI libraries available (spf13/cobra, urfave/cli). However sometimes an integrated shell interface is a great and useful extension for the actual application. This library offers a simple API to create powerful CLI applications and automatically starts an integrated interactive shell, if the application is started without any command arguments.

Hint: We do not guarantee 100% backwards compatiblity between minor versions (1.x). However, the API is mostly stable and should not change much.

asciicast

Introduction

Create a grumble APP.

var app = grumble.New(&grumble.Config{
	Name:        "app",
	Description: "short app description",

	Flags: func(f *grumble.Flags) {
		f.String("d", "directory", "DEFAULT", "set an alternative directory path")
		f.Bool("v", "verbose", false, "enable verbose mode")
	},
})

Register a top-level command. Note: Sub commands are also supported...

app.AddCommand(&grumble.Command{
    Name:      "daemon",
    Help:      "run the daemon",
    Aliases:   []string{"run"},

    Flags: func(f *grumble.Flags) {
        f.Duration("t", "timeout", time.Second, "timeout duration")
    },

    Args: func(a *grumble.Args) {
        a.String("service", "which service to start", grumble.Default("server"))
    },

    Run: func(c *grumble.Context) error {
        // Parent Flags.
        c.App.Println("directory:", c.Flags.String("directory"))
        c.App.Println("verbose:", c.Flags.Bool("verbose"))
        // Flags.
        c.App.Println("timeout:", c.Flags.Duration("timeout"))
        // Args.
        c.App.Println("service:", c.Args.String("service"))
        return nil
    },
})

Run the application.

err := app.Run()

Or use the builtin grumble.Main function to handle errors automatically.

func main() {
	grumble.Main(app)
}

Shell Multiline Input

Builtin support for multiple lines.

>>> This is \
... a multi line \
... command

Samples

Check out the sample directory for some detailed examples.

The grml project uses grumble.

Additional Useful Packages

Credits

This project is based on ideas from the great ishell library.

License

MIT