26 lines
617 B
Go
26 lines
617 B
Go
package commands
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/vleeuwenmenno/kcm/src/config"
|
|
"github.com/vleeuwenmenno/kcm/src/models"
|
|
)
|
|
|
|
func NewListCmd(history *models.History) *cobra.Command {
|
|
var noTrunc bool
|
|
cmd := &cobra.Command{
|
|
Use: "list",
|
|
Short: "List clipboard history",
|
|
Aliases: []string{"--list"},
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
cfg, _ := config.LoadConfig()
|
|
history.ReloadIfChanged(cfg.Clipboard.HistoryFile)
|
|
history.List(os.Stdout, noTrunc)
|
|
},
|
|
}
|
|
cmd.Flags().BoolVar(&noTrunc, "no-trunc", false, "Do not truncate clipboard entries")
|
|
return cmd
|
|
}
|