2025-10-04 00:20:04 +01:00
|
|
|
package cli
|
2025-09-26 09:33:16 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
2025-09-30 23:49:23 +01:00
|
|
|
"code.oliverdavies.uk/opdavies/cmd-zet/internal/zet"
|
2025-10-01 00:13:55 +01:00
|
|
|
"github.com/spf13/cobra"
|
2025-09-26 09:33:16 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
var createCmd = &cobra.Command{
|
|
|
|
Use: "create",
|
2025-09-26 12:24:08 +01:00
|
|
|
Aliases: []string{"c", "n", "new"},
|
2025-09-30 00:48:16 +01:00
|
|
|
Short: "Create a new zettel",
|
|
|
|
Long: `zet create|new|c|n TITLE`,
|
2025-10-04 00:20:04 +01:00
|
|
|
Run: func(cli *cobra.Command, args []string) {
|
2025-09-26 09:33:16 +01:00
|
|
|
title := ""
|
2025-09-26 12:17:37 +01:00
|
|
|
|
2025-09-26 09:33:16 +01:00
|
|
|
if len(args) > 0 {
|
|
|
|
title = strings.Join(args, " ")
|
|
|
|
}
|
|
|
|
|
2025-09-30 23:49:23 +01:00
|
|
|
zet.CreateZet(title)
|
2025-09-26 09:33:16 +01:00
|
|
|
},
|
|
|
|
}
|
2025-10-04 00:20:04 +01:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(createCmd)
|
|
|
|
}
|