mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-23 16:44:17 +02:00
Delete from stash command
This commit is contained in:
parent
bd52d1cee4
commit
4792345f31
2 changed files with 22 additions and 3 deletions
4
main.go
4
main.go
|
|
@ -256,7 +256,5 @@ func init() {
|
|||
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")
|
||||
|
||||
rootCmd.AddCommand(stashCmd)
|
||||
rootCmd.AddCommand(stashListCmd)
|
||||
rootCmd.AddCommand(stashGetCmd)
|
||||
rootCmd.AddCommand(stashCmd, stashListCmd, stashGetCmd, stashDeleteCmd)
|
||||
}
|
||||
|
|
|
|||
21
stash.go
21
stash.go
|
|
@ -82,6 +82,27 @@ var (
|
|||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
stashDeleteCmd = &cobra.Command{
|
||||
Use: "stash-delete",
|
||||
Hidden: false,
|
||||
Short: "get a stashed markdown by id",
|
||||
Long: "",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
id, err := strconv.Atoi(args[0])
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid markdown id")
|
||||
}
|
||||
cc := initCharmClient()
|
||||
err = cc.DeleteMarkdown(id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error deleting markdown")
|
||||
}
|
||||
fmt.Println("Deleted!")
|
||||
return nil
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func getCharmConfig() *charm.Config {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue