From da8aa52b5ce6d948a346d7dbf1254ca3faaeac80 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Sat, 6 Jun 2020 17:02:38 -0400 Subject: Add status subcommand --- status.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 status.go (limited to 'status.go') diff --git a/status.go b/status.go new file mode 100644 index 0000000..b9c7aa1 --- /dev/null +++ b/status.go @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" +) + +func status(conf *Conf, args []string) error { + if len(args) != 0 { + return statusFiles(conf, args) + } + names, err := conf.FileNames() + if err != nil { + return err + } + return statusFiles(conf, names) +} + +func statusFiles(conf *Conf, names []string) error { + for _, name := range names { + if err := statusFile(conf, name); err != nil { + return fmt.Errorf("could not check status of %s: %v", name, err) + } + } + return nil +} + +func statusFile(conf *Conf, name string) error { + fmt.Printf("%s: OK\n", name) + return nil +} -- cgit v1.2.3