mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-23 08:34:17 +02:00
List stash
This commit is contained in:
parent
03b7b9200c
commit
395ae998dd
2 changed files with 24 additions and 2 deletions
5
main.go
5
main.go
|
|
@ -252,9 +252,10 @@ func init() {
|
|||
rootCmd.Flags().StringVarP(&style, "style", "s", "auto", "style name or JSON path")
|
||||
rootCmd.Flags().UintVarP(&width, "width", "w", 0, "word-wrap at width")
|
||||
|
||||
stashCmd.PersistentFlags().StringVarP(&identityFile, "identity", "i", "", "path to identity file (that is, an ssh private key)")
|
||||
rootCmd.PersistentFlags().StringVarP(&identityFile, "identity", "i", "", "path to identity file (that is, an ssh private key)")
|
||||
rootCmd.Flags().BoolVarP(&forceKey, "force-key", "f", false, "for the use of the SSH key on disk (that is, ignore ssh-agent)")
|
||||
stashCmd.PersistentFlags().StringVarP(&memo, "memo", "m", "", "memo/note for stashing")
|
||||
stashCmd.Flags().BoolVarP(&forceKey, "force-key", "f", false, "for the use of the SSH key on disk (that is, ignore ssh-agent)")
|
||||
|
||||
rootCmd.AddCommand(stashCmd)
|
||||
rootCmd.AddCommand(stashListCmd)
|
||||
}
|
||||
|
|
|
|||
21
stash.go
21
stash.go
|
|
@ -39,6 +39,27 @@ var (
|
|||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
stashListCmd = &cobra.Command{
|
||||
Use: "stash-list",
|
||||
Hidden: false,
|
||||
Short: "list your stashed markdowns",
|
||||
Long: "",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
cc := initCharmClient()
|
||||
mds, err := cc.GetStash()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting stash")
|
||||
}
|
||||
fmt.Println("ID\tNote")
|
||||
fmt.Println("--\t----")
|
||||
for _, md := range mds {
|
||||
fmt.Printf("%d\t%s\n", md.ID, md.Note)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func getCharmConfig() *charm.Config {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue