summaryrefslogtreecommitdiff
path: root/internal/platforms/noop/noop.go
blob: 190a0704bff8f1e4d421f441faa33db0d0bdfff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package noop

import (
	"context"

	"codeberg.org/snonux/gos/internal/colour"
	"codeberg.org/snonux/gos/internal/config"
	"codeberg.org/snonux/gos/internal/entry"
	"codeberg.org/snonux/gos/internal/prompt"
)

// Psudo platform, not posting really anything.
func Post(ctx context.Context, args config.Args, sizeLimit int, en entry.Entry) error {
	content, _, err := en.ContentWithLimit(sizeLimit)
	if err != nil {
		return err
	}
	if args.DryRun {
		colour.Infoln("Not posting", en, "to Noop as dry-run enabled")
		return nil
	}
	if _, err = prompt.FileAction("Do you want to post this message to Noop?",
		content, en.Path, prompt.RandomOption); err != nil {
		return err
	}
	return nil
}