command

package
v2.10.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package command provides console operations, like options/arguments reading.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsOpt

func ContainsOpt(name string) bool

ContainsOpt checks whether option named `name` exist in the arguments.

func GetArg

func GetArg(index int, def ...string) string

GetArg returns the argument at `index`.

func GetArgAll

func GetArgAll() []string

GetArgAll returns all parsed arguments.

func GetOpt

func GetOpt(name string, def ...string) string

GetOpt returns the option value named `name`.

func GetOptAll

func GetOptAll() map[string]string

GetOptAll returns all parsed options.

func GetOptWithEnv

func GetOptWithEnv(key string, def ...string) string

GetOptWithEnv returns the command line argument of the specified `key`. If the argument does not exist, then it returns the environment variable with specified `key`. It returns the default value `def` if none of them exists.

Fetching Rules: 1. Command line arguments are in lowercase format, eg: gf.package.variable; 2. Environment arguments are in uppercase format, eg: GF_PACKAGE_VARIABLE;

func Init

func Init(args ...string)

Init does custom initialization.

func ParseUsingDefaultAlgorithm

func ParseUsingDefaultAlgorithm(args ...string) (parsedArgs []string, parsedOptions map[string]string)

ParseUsingDefaultAlgorithm parses arguments using default algorithm.

Types

This section is empty.

Jump to

Keyboard shortcuts

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