MCPcopy Index your code
hub / github.com/hashicorp/vault / flagSet

Method flagSet

command/base.go:390–645  ·  view source on GitHub ↗

flagSet creates the flags for this command. The result is cached on the command to save performance on future calls.

(bit FlagSetBit)

Source from the content-addressed store, hash-verified

388// flagSet creates the flags for this command. The result is cached on the
389// command to save performance on future calls.
390func (c *BaseCommand) flagSet(bit FlagSetBit) *FlagSets {
391 c.flagsOnce.Do(func() {
392 set := NewFlagSets(c.UI)
393
394 // These flag sets will apply to all leaf subcommands.
395 // TODO: Optional, but FlagSetHTTP can be safely removed from the individual
396 // Flags() subcommands.
397 bit = bit | FlagSetHTTP
398
399 if bit&FlagSetHTTP != 0 {
400 f := set.NewFlagSet("HTTP Options")
401
402 addrStringVar := &StringVar{
403 Name: flagNameAddress,
404 Target: &c.flagAddress,
405 EnvVar: api.EnvVaultAddress,
406 Completion: complete.PredictAnything,
407 Normalizers: []func(string) string{configutil.NormalizeAddr},
408 Usage: "Address of the Vault server.",
409 }
410
411 if c.flagAddress != "" {
412 addrStringVar.Default = c.flagAddress
413 } else {
414 addrStringVar.Default = "https://127.0.0.1:8200"
415 c.addrWarning = fmt.Sprintf("WARNING! VAULT_ADDR and -address unset. Defaulting to %s.", addrStringVar.Default)
416 }
417 f.StringVar(addrStringVar)
418
419 agentAddrStringVar := &StringVar{
420 Name: "agent-address",
421 Target: &c.flagAgentProxyAddress,
422 EnvVar: api.EnvVaultAgentAddr,
423 Completion: complete.PredictAnything,
424 Normalizers: []func(string) string{configutil.NormalizeAddr},
425 Usage: "Address of the Agent.",
426 }
427 f.StringVar(agentAddrStringVar)
428
429 f.StringVar(&StringVar{
430 Name: flagNameCACert,
431 Target: &c.flagCACert,
432 Default: "",
433 EnvVar: api.EnvVaultCACert,
434 Completion: complete.PredictFiles("*"),
435 Usage: "Path on the local disk to a single PEM-encoded CA " +
436 "certificate to verify the Vault server's SSL certificate. This " +
437 "takes precedence over -ca-path.",
438 })
439
440 f.StringVar(&StringVar{
441 Name: flagNameCAPath,
442 Target: &c.flagCAPath,
443 Default: "",
444 EnvVar: api.EnvVaultCAPath,
445 Completion: complete.PredictDirs("*"),
446 Usage: "Path on the local disk to a directory of PEM-encoded CA " +
447 "certificates to verify the Vault server's SSL certificate.",

Callers 15

FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80
FlagsMethod · 0.80

Calls 8

NewFlagSetMethod · 0.95
StringVarMethod · 0.95
BoolVarMethod · 0.95
DurationVarMethod · 0.95
StringSliceVarMethod · 0.95
StringMapVarMethod · 0.95
NewFlagSetsFunction · 0.85
DoMethod · 0.65

Tested by

no test coverage detected