package mfer import ( "fmt" "log" "os" "path/filepath" "github.com/pterm/pterm" "github.com/urfave/cli/v2" ) func Run(Appname, Version, Buildarch string) int { s, _ := pterm.DefaultBigText.WithLetters(pterm.NewLettersFromString(Appname)).Srender() pterm.DefaultCenter.Println(s) // Print BigLetters with the default CenterPrinter app := &cli.App{ Name: Appname, Usage: "Manifest generator", Commands: []*cli.Command{ { Name: "generate", Aliases: []string{"gen"}, Usage: "Generate manifest file", Action: func(c *cli.Context) error { return generateManifest(".", "./index.mf") }, Flags: []cli.Flag{ &cli.StringFlag{ Name: "input", Value: ".", Aliases: []string{"i"}, Usage: "Specify input directory.", }, &cli.StringFlag{ Name: "output", Value: "./index.mf", Aliases: []string{"o"}, Usage: "Specify output filename", }, }, }, }, } err := app.Run(os.Args) if err != nil { log.Fatal(err) return 1 } return 0 } func generateManifest(path, outputFilename string) error { fmt.Println("generateManifest()") walkErr := filepath.Walk(path, func(itemPath string, info os.FileInfo, err error) error { fmt.Println(itemPath) return nil }) if walkErr != nil { log.Fatal(walkErr) return walkErr } return nil }