Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions cmd/build-lambda-zip/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@ import (
"os"
"path/filepath"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

func main() {
app := cli.NewApp()
app.Name = "build-lambda-zip"
app.Usage = "Put an executable and supplemental files into a zip file that works with AWS Lambda."
app.Flags = []cli.Flag{
&cli.StringFlag{
Name: "output, o",
Value: "",
Usage: "output file path for the zip. Defaults to the first input file name.",
app := &cli.App{
Name: "build-lambda-zip",
Usage: "Put an executable and supplemental files into a zip file that works with AWS Lambda.",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "output, o",
Value: "",
Usage: "output file path for the zip. Defaults to the first input file name.",
},
},
}

app.Action = func(c *cli.Context) error {
if !c.Args().Present() {
return errors.New("no input provided")
}
Action: func(c *cli.Context) error {
if !c.Args().Present() {
return errors.New("no input provided")
}

inputExe := c.Args().First()
outputZip := c.String("output")
if outputZip == "" {
outputZip = fmt.Sprintf("%s.zip", filepath.Base(inputExe))
}
inputExe := c.Args().First()
outputZip := c.String("output")
if outputZip == "" {
outputZip = fmt.Sprintf("%s.zip", filepath.Base(inputExe))
}

if err := compressExeAndArgs(outputZip, inputExe, c.Args().Tail()); err != nil {
return fmt.Errorf("failed to compress file: %v", err)
}
return nil
if err := compressExeAndArgs(outputZip, inputExe, c.Args().Tail()); err != nil {
return fmt.Errorf("failed to compress file: %v", err)
}
return nil
},
}

if err := app.Run(os.Args); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.12

require (
github.com/stretchr/testify v1.4.0
github.com/urfave/cli v1.22.1
github.com/urfave/cli/v2 v2.1.1
)
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k=
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=