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

Function isPortExplicit

scripts/develop/main.go:292–306  ·  view source on GitHub ↗
(inv *serpent.Invocation, flagName, envName string)

Source from the content-addressed store, hash-verified

290}
291
292func isPortExplicit(inv *serpent.Invocation, flagName, envName string) bool {
293 if flag := inv.ParsedFlags().Lookup(flagName); flag != nil && flag.Changed {
294 return true
295 }
296 if val, ok := inv.Environ.Lookup(envName); ok && val != "" {
297 return true
298 }
299 for _, opt := range inv.Command.Options {
300 if opt.Flag == flagName {
301 return opt.ValueSource == serpent.ValueSourceFlag ||
302 opt.ValueSource == serpent.ValueSourceEnv
303 }
304 }
305 return false
306}
307
308// portOffset returns a deterministic offset in [0, 1000) derived from the
309// worktree path. Successive callers with the same projectRoot get the same

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected