// RunCfg runs authentication command func RunCfg(args []string) error { if *flagCfgCreate { return CreateCfg() } c := cfg.NewConfig() if err := cfg.Load(c); err != nil { return err } b, err := json.MarshalIndent(c, "", " ") if err != nil { return err } fmt.Fprintf(os.Stdout, "%s\n", b) return nil }
// RunIssues runs issues command func RunIssues(args []string) error { c := cfg.NewConfig() if err := cfg.Load(c); err != nil { return err } client := issues.NewClient(c) issues, err := client.Load() if err != nil { return err } tmpl := template.Must(template.New("issues").Parse(tmplIssues)) err = tmpl.Execute(os.Stdout, issues) if err != nil { return err } return nil }
// CreateCfg creates an emtpy config func CreateCfg() error { c := cfg.NewConfig() return cfg.Save(c) }