cli

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CLIRun

func CLIRun(args []string, co CLIOptions)

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type CLIOptions

type CLIOptions struct {
	JSONOutputEnabled      bool
	ProgressOutputDisabled bool
	UseNewLinkDisabled     bool
	CLIContentOnly         bool
	CLIMinFileSize         uintN
	CLIMaxFileSize         uintN
	CLIFileIncludes        RegexArray
	CLIFileExcludes        RegexArray
	CLIDirExcludes         RegexArray
	CLISearchThresh        intN
	CLIDebugLevel          int

	// Verbosity controls the level of output when calling the output
	// options.  Verbosity 0 prints a short summary of results (space
	// saved, etc.). Verbosity 1 outputs additional information on
	// comparison results and other stats.  Verbosity 2 also outputs the
	// linking that would be (or was) performed, and Verbosity 3 prints
	// information on what existing hardlinks were encountered.
	Verbosity int

	hardlinkable.Options
}

Because the pflags (and flags) boolean options don't toggle the default, but instead set it to true when specified, it's best to specify all boolean flags with a 'false' default. So, for options that we want to default to true (and thus disable when the option is given), we use a separate flag with the opposite default, and toggle it manually after parsing.

Other cliOptions are converted from one type to another in the Options struct

func (CLIOptions) ToOptions

func (c CLIOptions) ToOptions() hardlinkable.Options

type RegexArray

type RegexArray struct {
	flag.Value // "inherit" Value interface
	// contains filtered or unexported fields
}

Custom pflag Value displays "RE" instead of "stringArray" in usage text

func (*RegexArray) Set

func (r *RegexArray) Set(val string) error

Implement StringArray Value Set semantics

func (*RegexArray) String

func (r *RegexArray) String() string

Return the string "<nil>" to disable default usage text

func (*RegexArray) Type

func (r *RegexArray) Type() string

Return "RE" instead of "stringArray" for usage text

Jump to

Keyboard shortcuts

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