command

package
v0.0.0-...-7e18bce Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

包command提供控制台操作,如选项/参数读取。 md5:940e3926fff20c9a

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsOpt

func ContainsOpt(name string) bool

ContainsOpt 检查参数中是否存在名为 `name` 的选项。 md5:32ce4c1cf77651fb

func GetArg

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

GetArg 返回索引为 `index` 的参数。 md5:822343a8734fe602

func GetArgAll

func GetArgAll() []string

GetArgAll 返回所有解析的参数。 md5:85cc0fd5995d4878

func GetOpt

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

GetOpt 返回名为 `name` 的选项值。 md5:5de4cb85c231ce6b

func GetOptAll

func GetOptAll() map[string]string

GetOptAll 返回所有已解析的选项。 md5:6de4d266d8991786

func GetOptWithEnv

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

GetOptWithEnv 返回指定 `key` 的命令行参数。 如果该参数不存在,则返回指定 `key` 的环境变量。 如果两者都不存在,它将返回默认值 `def`。

获取规则: 1. 命令行参数采用小写格式,例如:gf.package.variable; 2. 环境变量采用大写格式,例如:GF_PACKAGE_VARIABLE。 md5:13bcb9c2795488a1

func Init

func Init(args ...string)

Init 进行自定义初始化。 md5:08f8a2052942d9c8

func ParseUsingDefaultAlgorithm

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

使用默认算法解析参数。 md5:d48f7f39a81379e1

Types

This section is empty.

Jump to

Keyboard shortcuts

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