cli

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 13

README

godoc Go Report Card

cli - command-line interface utilities

a collection of utilities for working with github.com/urfave/cli

Installation

> go get github.com/go-corelibs/cli@latest

Examples

FlagStringer

import (
    "github.com/urfave/cli/v2"

    clcli "github.com/go-corelibs/cli"
)

func init() {
    // - remove default text from boolean flag usage
    // - place defaults and env vars on newlines
    cli.FlagStringer = clcli.NewFlagStringer().
		PruneDefaultBools(true).
		DetailsOnNewLines(true).
		Make()
}

Go-CoreLibs

Go-CoreLibs is a repository of shared code between the Go-Curses and Go-Enjin projects.

License

Copyright 2024 The Go-CoreLibs Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use file except in compliance with the License.
You may obtain a copy of the license at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Documentation

Overview

Package cli provides command-line interface utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearEmptyCategories

func ClearEmptyCategories(flags []cli.Flag)

Types

type FlagStringer

type FlagStringer interface {
	// PruneEnvVars specifies if `[$ENV_VAR...]` text is removed
	PruneEnvVars(enable bool) FlagStringer
	// PruneDefaults specifies if `(default: ...)` text is removed
	PruneDefaults(enable bool) FlagStringer
	// PruneDefaultBools specifies if only boolean flag defaults are removed
	PruneDefaultBools(enable bool) FlagStringer
	// PruneRepeats specifies if slice flags have their repeated example removed
	PruneRepeats(enable bool) FlagStringer
	// DetailsOnNewLines specifies if defaults and env vars are places on new
	// lines instead of all in one line
	DetailsOnNewLines(enable bool) FlagStringer
	// Make produces the cli.FlagStringFunc
	Make() cli.FlagStringFunc
}

FlagStringer is a buildable interface for constructing a pre-configured cli.FlagStringFunc instances

func NewFlagStringer

func NewFlagStringer() FlagStringer

NewFlagStringer creates a new FlagStringer instance, ready to be configured and made into a cli.FlagStringFunc

Jump to

Keyboard shortcuts

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