-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathargs-create.go
35 lines (31 loc) · 992 Bytes
/
args-create.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
package main
import ()
type Create struct {
File string `help:"The file to save on paper" type:"existingfile" arg`
MaxSize int `help:"Set maximum file size." default:8192`
Format string `help:"Set the output format type." default:"pdf" enum:"pdf,text"`
Encrypt bool `help:"Encrypt the source file." short:"e"`
Password string `help:"Set the encryption password." short:"p"`
ShowPassword bool `help:"Show password in the generated file."`
Keep bool `help:"Keep build files."`
Shares int `help:"How many shares to generate." default:1 group:"shamir"`
Thresholds int `help:"How many threshold are need to generate original." default:1 group:"shamir"`
}
func (c *Create) Run(ctx *CLIContext) (err error) {
p, err := NewPSFile(c)
if err != nil {
return
}
for _, s := range p.Shares {
switch c.Format {
case "text":
err = s.Text()
case "pdf":
err = s.Latex()
}
if err != nil {
return
}
}
return
}