50 lines
874 B
Go
50 lines
874 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
func main() {
|
|
app := cli.NewApp()
|
|
|
|
app.Commands = []cli.Command{
|
|
{
|
|
Name: "scan",
|
|
Aliases: []string{"s"},
|
|
Usage: "Scan a directory's manifests",
|
|
Action: func(c *cli.Context) error {
|
|
if len(c.Args()) > 0 {
|
|
return scan(c)
|
|
}
|
|
return cli.NewExitError("no directory provided", 5)
|
|
},
|
|
},
|
|
{
|
|
Name: "configure",
|
|
Aliases: []string{"c"},
|
|
Usage: "Configure the app",
|
|
Action: func(c *cli.Context) error {
|
|
return cli.NewExitError("No Configuration provided", 4)
|
|
},
|
|
},
|
|
}
|
|
|
|
err := app.Run(os.Args)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func scan(c *cli.Context) error {
|
|
directory := c.Args().First()
|
|
|
|
fmt.Println(strings.Join(getListOfManifestFilenames(directory), ", "))
|
|
// TODO, actually scan, don't just print names
|
|
return nil
|
|
}
|