campaigner/cmd/status.go

26 lines
444 B
Go
Raw Normal View History

2020-03-06 19:54:52 +01:00
package cmd
import (
"git.ctrlz.es/mgdelacroix/campaigner/campaign"
"github.com/spf13/cobra"
)
func StatusCmd() *cobra.Command {
return &cobra.Command{
2020-03-07 11:11:40 +01:00
Use: "status",
2020-03-06 19:54:52 +01:00
Short: "Prints the current status of the campaign",
2020-03-07 11:11:40 +01:00
Args: cobra.NoArgs,
Run: statusCmdF,
2020-03-06 19:54:52 +01:00
}
}
func statusCmdF(cmd *cobra.Command, _ []string) {
cmp, err := campaign.Read()
if err != nil {
ErrorAndExit(cmd, err)
}
cmp.PrintStatus(cmd.OutOrStdout())
}