cli

package
v0.0.0-...-303e327 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var App = grumble.New(&grumble.Config{
	Name:                  "blobstore manager",
	Description:           "A command manager of blobstore",
	HistoryFile:           path.Join(os.TempDir(), ".blobstore_cli.history"),
	HistoryLimit:          10000,
	ErrorColor:            color.New(color.FgRed, color.Bold, color.Faint),
	HelpHeadlineColor:     color.New(color.FgGreen),
	HelpHeadlineUnderline: false,
	HelpSubCommands:       true,
	Prompt:                "BS $> ",
	PromptColor:           color.New(color.FgBlue, color.Bold),
	PromptRuntime: func() func() string {
		username := "NO-USER"
		hostname := "NO-HOSTNAME"
		if user, err := user.Current(); err == nil {
			username = user.Username
		}
		if host, _ := os.Hostname(); host != "" {
			hostname = host
		}

		return func() string {
			now := time.Now()
			mins := (now.Hour() * 60) + now.Minute()
			curr := mins * 100 / (60 * 24)
			tStr := now.Format("01-02 15:04:05.000")
			return color.New().Sprintf("%s %s%s %s@%s %s ",
				color.New(color.FgBlue, color.Italic).Sprint("BS"),
				color.New(color.FgMagenta, color.Faint).Sprintf("[%s]", common.BoldBar(curr)),
				color.New(color.FgMagenta, color.Faint).Sprintf("[%s]", tStr),
				color.New(color.FgGreen, color.Bold).Sprint(username),
				color.New(color.FgYellow, color.Bold).Sprint(hostname),
				color.New(color.FgBlack, color.BgHiYellow).Sprint("  $> "),
			)
		}
	}(),
	Flags: func(f *grumble.Flags) {
		flags.ConfigRegister(f)
		flags.VerboseRegister(f)
		flags.VverboseRegister(f)
		f.BoolL("silence", false, "disable print output")
	},
})

App blobstore command app

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cfmt
Package cfmt provides fmt string for all struct in blobstore
Package cfmt provides fmt string for all struct in blobstore
fmt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL