-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
52 lines (42 loc) · 1.02 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"os"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var (
version = "1.1.5"
)
func main() {
// referenced from https://github.com/drone-plugins/drone-gitea-release/blob/master/main.go
app := cli.NewApp()
app.Name = "drone-compressed-files plugin"
app.Usage = "drone-compressed-files plugin"
app.Action = run
app.Version = version
app.Flags = []cli.Flag{
cli.StringSliceFlag{
Name: "input",
Usage: "file input eg: a.txt, /app/a.txt , a/*.js,test/**/*.js",
EnvVar: "PLUGIN_INPUT,ZIP_INPUT",
},
cli.StringFlag{
Name: "output",
Usage: "output zip file path eg: /app/a.zip",
EnvVar: "PLUGIN_OUTPUT,ZIP_OUTPUT",
},
}
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}
func run(c *cli.Context) error {
plugin := Plugin{
Input: c.StringSlice("input"),
Output: c.String("output"),
}
logrus.Infof("drone-zip version: %s", version)
logrus.Infof("input: %v", plugin.Input)
logrus.Infof("output: %v\n", plugin.Output)
return plugin.Exec()
}