func KeysRemoveAutoComplete(c *cli.Context) error { keys, err := api.KeysList() if err == nil { for _, key := range keys { fmt.Println(key.Name) } } return nil }
func keyByName(name string) (*api.Key, error) { keys, err := api.KeysList() if err != nil { return nil, errgo.Mask(err) } for _, k := range keys { if k.Name == name { return &k, nil } } return nil, errgo.New("no such key") }
func List() error { keys, err := api.KeysList() if err != nil { return errgo.Mask(err) } t := tablewriter.NewWriter(os.Stdout) t.SetColWidth(60) t.SetHeader([]string{"Name", "Content"}) for _, k := range keys { t.Append([]string{k.Name, k.Content[0:20] + "..." + k.Content[len(k.Content)-30:]}) } t.Render() return nil }