MCPcopy Index your code
hub / github.com/coder/coder / userSetOption

Function userSetOption

cli/util.go:27–34  ·  view source on GitHub ↗

userSetOption returns true if the option was set by the user. This is helpful if the zero value of a flag is meaningful, and you need to distinguish between the user setting the flag to the zero value and the user not setting the flag at all.

(inv *serpent.Invocation, flagName string)

Source from the content-addressed store, hash-verified

25// to distinguish between the user setting the flag to the zero value and
26// the user not setting the flag at all.
27func userSetOption(inv *serpent.Invocation, flagName string) bool {
28 for _, opt := range inv.Command.Options {
29 if opt.Name == flagName {
30 return !(opt.ValueSource == serpent.ValueSourceNone || opt.ValueSource == serpent.ValueSourceDefault)
31 }
32 }
33 return false
34}
35
36// durationDisplay formats a duration for easier display:
37// - Durations of 24 hours or greater are displays as Xd

Callers 3

templateEditMethod · 0.85
secretUpdateMethod · 0.85
secretValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected