package
1.3.48
Repository: https://github.com/sandwich-go/boost.git
Documentation: pkg.go.dev

# README

xcmd

命令行参数或Env参数

例子

var name1 = fmt.Sprintf("%sdebug", GetFlagPrefix())
var name2 = fmt.Sprintf("%sp1", GetFlagPrefix())
var name3 = fmt.Sprintf("%sp2", GetFlagPrefix())
Init(fmt.Sprintf("--%s=true", name1), fmt.Sprintf("--%s", name2), "test", fmt.Sprintf("--%s", name3))

fmt.Println(IsTrue(GetOptWithEnv(name1)))
fmt.Println(GetOptWithEnv(name2))
fmt.Println(IsTrue(GetOptWithEnv(name3)))

Output:

true
test
false

# Functions

AddFlag 添加框架内默认的 flag 数据 name 必须有 flagPrefix 前缀,不能包含.-/\字符.
ContainsOpt checks whether option named `name` exist in the arguments.
DeclareInto 将 command 预留的 flag 定义添加到指定的 FlagSet 中.
GetFlagPrefix 获取 flag 的前缀.
GetOptWithEnv 返回命令定义的行参数或Env中的参数 1.
Init 根据给定的参数初始化预留的参数,如果args为空,则会使用os.Args初始化.
MustAddFlag 添加框架内默认的 flag 数据,若失败,则panic name 必须有 flagPrefix 前缀,不能包含特殊的字符.
SetFlagPrefix 设置 flag 的前缀.
Slice 将 defaultSliceSeparator 分割的字符获取slice.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

IsFalse 判断command解析获取的数据是否为 false ""、"0"、"n"、"no"、"off"、"false" 均为 true,并且忽略大小写.
IsTrue 判断command解析获取的数据是否为 true ""、"0"、"n"、"no"、"off"、"false" 均为 true,并且忽略大小写.