Exemple #1
0
Fichier : cfg.go Projet : skhal/gh
// 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
}
Exemple #2
0
// 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
}