-
Notifications
You must be signed in to change notification settings - Fork 0
/
opt.go
37 lines (31 loc) · 866 Bytes
/
opt.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
package embedemail
import (
"fmt"
"os"
"path/filepath"
"github.com/alecthomas/kong"
)
type about bool
func (a about) BeforeApply() (err error) {
fmt.Println("Visit https://github.com/gonejack/embed-email")
os.Exit(0)
return
}
type Options struct {
RetainGif bool `name:"retain-gif" help:"Will not convert gif into mp4."`
Verbose bool `short:"v" help:"Verbose printing."`
MediaDir string `hidden:"" default:"media"`
About about `help:"About."`
Eml []string `name:".eml" arg:"" optional:"" help:"list of .eml files"`
}
func MustParseOptions() (opts Options) {
kong.Parse(&opts,
kong.Name("embed-email"),
kong.Description("This command parse email content, download remote images and replace them as inline images"),
kong.UsageOnError(),
)
if len(opts.Eml) == 0 {
opts.Eml, _ = filepath.Glob("*.eml")
}
return
}