tideliftcli/main.go
Tyrel Souza 104aa44ef5
chdir
2019-05-15 22:41:12 -04:00

55 lines
964 B
Go

package main
import (
"fmt"
"log"
"os"
"strings"
"github.com/urfave/cli"
)
/*
scan,s [directory-with-.tidelift.yml]
configure,c [directory-with-.tidelift.yml]
*/
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
}