go_sysutils/exec_extra/consts.go
2024-06-17 04:33:30 -04:00

124 lines
3.5 KiB
Go

package exec_extra
import (
`r00t2.io/goutils/bitmask`
)
var (
CmdArgsTag string = "cmdarg"
/*
CmdArgsDictSep specifies the string to use to separate keys and values.
To override at the struct field level, use the tag value:
`<CmdArgsTag>:"dictsep=<str>"`
Where str is the string to use. e.g.:
`cmdarg:"short=d,long=data,dictsep=."`
Would render a map value of map[string]string{"foo": "bar"} as:
`-d foo.bar`
*/
CmdArgsDictSep string = ":"
)
// CmdArgOptNone is an "empty option" and does nothing.
const CmdArgOptNone bitmask.MaskBit = 0
const (
/*
CmdArgOptPreferShort prefers short options where possible.
Has no effect if Windows traditional syntax is used.
The default is to use long options.
See also CmdArgOptPreferLong.
Corresponding struct tag option: prefer_short
*/
CmdArgOptPreferShort cmdArgOpt = 1 << iota
/*
CmdArgOptPreferLong prefers long options where possible.
Has no effect if Windows traditional syntax is used.
This behavior is the default, but it can be used to
override a CmdArgOptPreferShort from a parent.
Corresponding struct tag option: prefer_long
*/
CmdArgOptPreferLong
/*
CmdArgOptShortEquals will use an equals separator
for short flags instead of a space (the default).
Has no effect if Windows traditional syntax is used.
Corresponding struct tag option: short_equals
*/
CmdArgOptShortEquals
/*
CmdArgOptShortNoEquals will use a space separator
for short flags instead of an equals.
Has no effect if Windows traditional syntax is used.
This behavior is the default, but it can be used to
override a CmdArgOptPreferShort from a parent.
Corresponding struct tag option: no_short_equals
*/
CmdArgOptShortNoEquals
/*
CmdArgOptLongEquals will use an equals separator
for long flags instead of a space.
Has no effect if Windows traditional syntax is used.
This behavior is the default, but it can be used to
override a CmdArgOptLongNoEquals from a parent.
Corresponding struct tag option: long_equals
*/
CmdArgOptLongEquals
/*
CmdArgOptLongNoEquals will use a space separator
for short flags instead of an equals.
Has no effect if Windows traditional syntax is used.
This behavior is the default, but it can be used to
override a CmdArgOptPreferShort from a parent.
Corresponding struct tag option: no_long_equals
*/
CmdArgOptLongNoEquals
/*
CmdArgOptForceNoPosix forces the resulting command string to use "traditional Windows" flag notation.
Traditionally, Windows used flags like `/f` instead of POSIX `-f`, `/c:value` instead of `-c value`
or `-c=value`, etc.
Has no effect if not running on Windows.
This behavior is the default, but it can be used to
override a CmdArgOptPreferShort from a parent.
See also the inverse of this option, CmdArgOptForcePosix.
Corresponding struct tag option: force_no_posix
*/
CmdArgOptForceNoPosix
/*
CmdArgOptForcePosix forces the resulting command string to use "POSIX" flag notation.
Traditionally, Windows used flags like `/f` instead of POSIX `-f`, `/c:value` instead of `-c value`
or `-c=value`, etc.
If this option is passed, then the POSIX flag syntax (-a/--arg) will be used instead.
Note that on Windows runtime, the default is to use the traditional slash-based syntax.
If you are generating command strings for Powershell or third-party software, you probably
want to use CmdArgsOptForcePosix instead.
See also the inverse of this option, CmdArgsOptForceNoPosix.
Corresponding struct tag option: force_posix
*/
CmdArgOptForcePosix
)