(ctx context.DnoteCtx)
| 75 | } |
| 76 | |
| 77 | func getContent(ctx context.DnoteCtx) (string, error) { |
| 78 | if contentFlag != "" { |
| 79 | return contentFlag, nil |
| 80 | } |
| 81 | |
| 82 | // check for piped content |
| 83 | fInfo, _ := os.Stdin.Stat() |
| 84 | if fInfo.Mode() & os.ModeCharDevice == 0 { |
| 85 | c, err := ui.ReadStdInput() |
| 86 | if err != nil { |
| 87 | return "", errors.Wrap(err, "Failed to get piped input") |
| 88 | } |
| 89 | return c, nil |
| 90 | } |
| 91 | |
| 92 | fpath, err := ui.GetTmpContentPath(ctx) |
| 93 | if err != nil { |
| 94 | return "", errors.Wrap(err, "getting temporarily content file path") |
| 95 | } |
| 96 | |
| 97 | c, err := ui.GetEditorInput(ctx, fpath) |
| 98 | if err != nil { |
| 99 | return "", errors.Wrap(err, "Failed to get editor input") |
| 100 | } |
| 101 | |
| 102 | return c, nil |
| 103 | } |
| 104 | |
| 105 | func newRun(ctx context.DnoteCtx) infra.RunEFunc { |
| 106 | return func(cmd *cobra.Command, args []string) error { |
no test coverage detected