File: args.go

package info (click to toggle)
tiup 1.16.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,384 kB
  • sloc: sh: 1,988; makefile: 138; sql: 16
file content (16 lines) | stat: -rw-r--r-- 363 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package utils

// RebuildArgs move "--help" or "-h" flag to the end of the arg list
func RebuildArgs(args []string) []string {
	helpFlag := "--help"
	argList := []string{}
	for _, arg := range args {
		if arg == "-h" || arg == "--help" {
			helpFlag = arg
		} else {
			argList = append(argList, arg)
		}
	}
	argList = append(argList, helpFlag)
	return argList
}