/
commands.go
138 lines (136 loc) · 2.97 KB
/
commands.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package commands
import (
"github.com/urfave/cli/v2"
)
// Commands contains all commands of the application
var Commands = []*cli.Command{
{
Name: "version",
Usage: "Show the application's version",
Action: versionCommand,
},
{
Name: "webarchive",
Usage: "Work with WebArchives",
Action: webArchiveCommand,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "path",
Usage: "Path to read",
Value: "",
},
},
},
{
Name: "warc",
Usage: "Work with WARCs",
Action: warcCommand,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "path",
Usage: "Path to read",
Value: "",
},
&cli.BoolFlag{
Name: "compressed",
Usage: "Whether or not to treat the input archive as compressed. True by default if extension ends with '.gz'",
Value: false,
},
},
},
{
Name: "archive",
Usage: "Archive sites",
Action: archiveCommand,
Flags: []cli.Flag{
&cli.StringSliceFlag{
Name: "url",
Usage: "URL to a resource to archive. May be used more than once.",
},
&cli.BoolFlag{
Name: "headers-only",
Usage: "Only print headers for the resulting WARC file",
Value: false,
},
&cli.UintFlag{
Name: "parallelism",
Usage: "The number of concurrent jobs to perform",
Value: 5,
},
&cli.StringFlag{
Name: "output",
Aliases: []string{"o"},
Usage: "The path to write the output too. If output is not specified, stdout will be used.",
},
&cli.BoolFlag{
Name: "compress",
Aliases: []string{"c"},
Usage: "Whether or not to compress the WARC using gzip.",
Value: false,
},
},
},
{
Name: "convert",
Usage: "Convert between formats",
Action: convertCommand,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "input",
Aliases: []string{"i"},
Usage: "Input path",
Value: "",
},
&cli.StringFlag{
Name: "input-format",
Usage: "Input format. One of 'warc', 'warc.gz'",
Value: "warc",
},
&cli.StringFlag{
Name: "output",
Aliases: []string{"o"},
Usage: "Output path",
Value: "",
},
&cli.StringFlag{
Name: "output-format",
Usage: "Output file format. One of 'dir', 'tar', 'tgz'",
Value: "",
},
},
},
{
Name: "serve",
Usage: "Serve a WARC archive",
Action: serveCommand,
ArgsUsage: "<path to archive>",
Flags: []cli.Flag{
&cli.UintFlag{
Name: "port",
Aliases: []string{"p"},
Usage: "Port to listen on",
Value: 8080,
},
&cli.StringFlag{
Name: "address",
Usage: "Address to listen on",
Value: "",
},
&cli.BoolFlag{
Name: "no-interface",
Usage: "Disable the Larch interface",
Value: false,
},
&cli.BoolFlag{
Name: "compressed",
Usage: "Whether or not to treat the input archive as compressed. True by default if extension ends with '.gz'",
Value: false,
},
&cli.StringFlag{
Name: "site",
Usage: "The host part of the site to serve",
Required: true,
},
},
},
}