MCPcopy
hub / github.com/perkeep/perkeep / shiftFlags

Function shiftFlags

pkg/cmdmain/cmdmain.go:356–366  ·  view source on GitHub ↗

shiftFlags prepends all the arguments (global flags) passed before the given mode to the list of arguments after that mode, and returns that list.

(mode string)

Source from the content-addressed store, hash-verified

354// shiftFlags prepends all the arguments (global flags) passed before the given
355// mode to the list of arguments after that mode, and returns that list.
356func shiftFlags(mode string) []string {
357 modePos := 0
358 for k, v := range os.Args {
359 if v == mode {
360 modePos = k
361 break
362 }
363 }
364 globalFlags := os.Args[1:modePos]
365 return append(globalFlags, os.Args[modePos+1:]...)
366}
367
368// Errorf prints to Stderr, regardless of FlagVerbose.
369func Errorf(format string, args ...interface{}) {

Callers 1

runAsNewCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected