-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathargs-decode.go
40 lines (35 loc) · 855 Bytes
/
args-decode.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
package main
import (
// "errors"
"fmt"
)
type Decode struct {
Files []string `help:"Image files to read QRCode from." type:"existingfile" arg`
Method string `help:"QRcode deoding method." enum:",${qrcode_methods}"`
SplitBlocks bool `help:"Add a blank line between block."`
}
func (c *Decode) Run(ctx *CLIContext) (err error) {
// var method int
// if c.Method == "" {
// method = QRCODE_DECODER_MAX
// } else {
// var ok bool
// method, ok = QRCodeDecoders[c.Method]
// if !ok {
// err = errors.New(fmt.Sprintf("Unknown method %s", c.Method))
// return
// }
// }
data, err := DecodeQRCode(c.Files, c.SplitBlocks)
if err != nil {
return
}
fmt.Printf("%s", data)
return
// data, err = DecodeQRCodeMethod(c.Files, method)
// if err != nil {
// return
// }
// fmt.Printf("%s\n", data)
// return
}