-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
list_default_template_cmd.go
53 lines (38 loc) · 1.25 KB
/
list_default_template_cmd.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// List our default email-template
//
package main
import (
"fmt"
"github.com/skx/rss2email/template"
"github.com/skx/subcommands"
)
// listDefaultTemplateCmd holds our state.
type listDefaultTemplateCmd struct {
// We embed the NoFlags option, because we accept no command-line flags.
subcommands.NoFlags
}
// Info is part of the subcommand-API
func (l *listDefaultTemplateCmd) Info() (string, string) {
return "list-default-template", `Display the default email-template.
An embedded template is used to format the emails which are sent by this
application, when new feed items are discovered. If you wish to change
the way the emails are formed, or formatted, you can replace this template
with a local copy.
To replace the template which is used simple create a new file located at
'~/.rss2email/email.tmpl', with your content.
This sub-command can be used to give you a starting point for your edits:
$ rss2email list-default-template > ~/.rss2email/email.tmpl
Example:
$ rss2email list-default-template
`
}
//
// Entry-point.
//
func (l *listDefaultTemplateCmd) Execute(args []string) int {
// Load the default template from the embedded resource.
content := template.EmailTemplate()
fmt.Fprintf(out, "%s\n", string(content))
return 0
}