@@ -8,36 +8,36 @@ import (
88 "os"
99 "path/filepath"
1010
11- "github.com/urfave/cli"
11+ "github.com/urfave/cli/v2 "
1212)
1313
1414func main () {
15- app := cli .NewApp ()
16- app .Name = "build-lambda-zip"
17- app .Usage = "Put an executable and supplemental files into a zip file that works with AWS Lambda."
18- app .Flags = []cli.Flag {
19- & cli.StringFlag {
20- Name : "output, o" ,
21- Value : "" ,
22- Usage : "output file path for the zip. Defaults to the first input file name." ,
15+ app := & cli.App {
16+ Name : "build-lambda-zip" ,
17+ Usage : "Put an executable and supplemental files into a zip file that works with AWS Lambda." ,
18+ Flags : []cli.Flag {
19+ & cli.StringFlag {
20+ Name : "output, o" ,
21+ Value : "" ,
22+ Usage : "output file path for the zip. Defaults to the first input file name." ,
23+ },
2324 },
24- }
25-
26- app .Action = func (c * cli.Context ) error {
27- if ! c .Args ().Present () {
28- return errors .New ("no input provided" )
29- }
25+ Action : func (c * cli.Context ) error {
26+ if ! c .Args ().Present () {
27+ return errors .New ("no input provided" )
28+ }
3029
31- inputExe := c .Args ().First ()
32- outputZip := c .String ("output" )
33- if outputZip == "" {
34- outputZip = fmt .Sprintf ("%s.zip" , filepath .Base (inputExe ))
35- }
30+ inputExe := c .Args ().First ()
31+ outputZip := c .String ("output" )
32+ if outputZip == "" {
33+ outputZip = fmt .Sprintf ("%s.zip" , filepath .Base (inputExe ))
34+ }
3635
37- if err := compressExeAndArgs (outputZip , inputExe , c .Args ().Tail ()); err != nil {
38- return fmt .Errorf ("failed to compress file: %v" , err )
39- }
40- return nil
36+ if err := compressExeAndArgs (outputZip , inputExe , c .Args ().Tail ()); err != nil {
37+ return fmt .Errorf ("failed to compress file: %v" , err )
38+ }
39+ return nil
40+ },
4141 }
4242
4343 if err := app .Run (os .Args ); err != nil {
0 commit comments