mirror of
https://github.com/fleetdm/fleet
synced 2026-05-06 06:48:54 +00:00
# Overview This pull request resolves #31165, implementing command-line tooling to migrate GitOps YAML files following the [changes introduced in the upcoming 4.74 release](https://github.com/fleetdm/fleet/pull/32237/files#diff-8769f6e90e8bdf15faad8f390fdf3ffb6fd2238b7d6087d83518c21464109119R7). Aligning with the recommended steps in the `README`; [this is an example of the first step](https://github.com/Illbjorn/fleet/pull/3/files) (`gitops-migrate format`) and [this is an example of the second step](https://github.com/Illbjorn/fleet/pull/4/files) (`gitops-migrate migrate`). --------- Signed-off-by: Illbjorn <am@hades.so> Co-authored-by: Ian Littman <iansltx@gmail.com>
41 lines
673 B
Go
41 lines
673 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"os"
|
|
|
|
"github.com/fleetdm/fleet/v4/cmd/gitops-migrate/log"
|
|
)
|
|
|
|
type Args struct {
|
|
Debug bool
|
|
Help bool
|
|
Commands []string
|
|
}
|
|
|
|
func parseArgs() Args {
|
|
var args Args
|
|
|
|
// Override the default flag package's usage text.
|
|
flag.Usage = func() {
|
|
err := usageText(os.Stderr)
|
|
if err != nil {
|
|
log.Fatal("Failed to write usage text to stderr :|.")
|
|
}
|
|
}
|
|
|
|
// --debug
|
|
flag.BoolVar(&args.Debug, "debug", false, "")
|
|
|
|
// --help
|
|
flag.BoolVar(&args.Help, "help", false, "")
|
|
flag.BoolVar(&args.Help, "h", false, "")
|
|
|
|
// Parse command-line inputs.
|
|
flag.Parse()
|
|
|
|
// Capture positional args.
|
|
args.Commands = flag.Args()
|
|
|
|
return args
|
|
}
|