MCPcopy
hub / github.com/dnote/dnote / NewCmd

Function NewCmd

pkg/cli/cmd/view/view.go:51–66  ·  view source on GitHub ↗

NewCmd returns a new view command

(ctx context.DnoteCtx)

Source from the content-addressed store, hash-verified

49
50// NewCmd returns a new view command
51func NewCmd(ctx context.DnoteCtx) *cobra.Command {
52 cmd := &cobra.Command{
53 Use: "view <book name?> <note index?>",
54 Aliases: []string{"v"},
55 Short: "List books, notes or view a content",
56 Example: example,
57 RunE: newRun(ctx),
58 PreRunE: preRun,
59 }
60
61 f := cmd.Flags()
62 f.BoolVarP(&nameOnly, "name-only", "", false, "print book names only")
63 f.BoolVarP(&contentOnly, "content-only", "", false, "print the note content only")
64
65 return cmd
66}
67
68func newRun(ctx context.DnoteCtx) infra.RunEFunc {
69 return func(cmd *cobra.Command, args []string) error {

Callers 1

mainFunction · 0.92

Calls 1

newRunFunction · 0.70

Tested by

no test coverage detected