Create a new zettel with a given title
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
parent
59c4d132b2
commit
b2f7f7af7f
3 changed files with 78 additions and 0 deletions
32
cmd/create.go
Normal file
32
cmd/create.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"code.oliverdavies.uk/opdavies/cmd-zet/internal/lib"
|
||||
)
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create",
|
||||
Aliases: []string{"e"},
|
||||
Short: "A brief description of your command",
|
||||
Long: `A longer description that spans multiple lines and likely contains examples
|
||||
and usage of using your command. For example:
|
||||
|
||||
Cobra is a CLI library for Go that empowers applications.
|
||||
This application is a tool to generate the needed files
|
||||
to quickly create a Cobra application.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
title := ""
|
||||
if len(args) > 0 {
|
||||
title = strings.Join(args, " ")
|
||||
}
|
||||
|
||||
lib.CreateZet(title)
|
||||
|
||||
// TODO: Edit the file
|
||||
// TODO: Commit the changes
|
||||
},
|
||||
}
|
|
@ -31,6 +31,7 @@ func Execute() {
|
|||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(createCmd)
|
||||
rootCmd.AddCommand(editCmd)
|
||||
rootCmd.AddCommand(findCmd)
|
||||
rootCmd.AddCommand(titlesCmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue