MCPcopy Index your code
hub / github.com/dnote/dnote / NewCmd

Function NewCmd

pkg/cli/cmd/edit/edit.go:49–65  ·  view source on GitHub ↗

NewCmd returns a new edit command

(ctx context.DnoteCtx)

Source from the content-addressed store, hash-verified

47
48// NewCmd returns a new edit command
49func NewCmd(ctx context.DnoteCtx) *cobra.Command {
50 cmd := &cobra.Command{
51 Use: "edit <note id|book name>",
52 Short: "Edit a note or a book",
53 Aliases: []string{"e"},
54 Example: example,
55 PreRunE: preRun,
56 RunE: newRun(ctx),
57 }
58
59 f := cmd.Flags()
60 f.StringVarP(&contentFlag, "content", "c", "", "a new content for the note")
61 f.StringVarP(&bookFlag, "book", "b", "", "the name of the book to move the note to")
62 f.StringVarP(&nameFlag, "name", "n", "", "a new name for a book")
63
64 return cmd
65}
66
67func preRun(cmd *cobra.Command, args []string) error {
68 if len(args) != 1 && len(args) != 2 {

Callers 1

mainFunction · 0.92

Calls 1

newRunFunction · 0.70

Tested by

no test coverage detected