-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.go
41 lines (35 loc) · 819 Bytes
/
main.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
package main
import (
"log"
"os"
"github.com/alash3al/re-txt/handlers"
"github.com/urfave/cli/v2"
_ "github.com/alash3al/re-txt/handlers/text"
)
func main() {
app := &cli.App{
Name: "re-txt",
Usage: "convert anything to anything",
EnableBashCompletion: true,
Commands: []*cli.Command{},
Flags: []cli.Flag{
&cli.StringSliceFlag{
Name: "src",
Aliases: []string{"s"},
Usage: "the source filename",
},
&cli.StringFlag{
Name: "dest",
Aliases: []string{"d"},
Usage: "the destenation filename",
},
},
}
for _, h := range handlers.Handlers() {
h.Command.Action = wrapHandler(h.Action)
app.Commands = append(app.Commands, &h.Command)
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err.Error())
}
}