You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.
varopenNullbooldelimiter:=byte('\n')
command.Opt("0, null", "end each output line with NUL, not newline").
Flags(flag.Posix).
Var(&openNull)
ifopenNull {
delimiter=byte(0)
}
假如设置 byte类型 不需要后面跟值
delimiter:=byte(0)
command.Opt("0, null", "end each output line with NUL, not newline").
Flags(flag.Posix).
MatchVar(&delimiter, '\n')
经常有这么一个场景,如果设置-0 或者设置-null 命令行选项 得到 '\0'输出。否则使用'\n'输出。
现在要实现效果的做法
假如设置 byte类型 不需要后面跟值
MatchVar的语意与DefaultVar是截然不同的
MatchVar函数如果发现有注册的选项,则使用MatchVar函数第二个参数的值。
DefaultVar函数如果没有选项匹配,则使用DefaultVar函数第二个参数的值。
The text was updated successfully, but these errors were encountered: