Skip to content

Commit

Permalink
exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
enr committed Sep 24, 2022
1 parent 5cfef4d commit 47679ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/zipts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type runConfig struct {
Args []string
Noop bool
OutputDir string
Exclude string
Exclude []string
}

func mainAction(c *cli.Context) {
Expand All @@ -71,7 +71,7 @@ func mainAction(c *cli.Context) {
Args: c.Args(),
Noop: c.Bool("noop"),
OutputDir: c.String("out"),
Exclude: c.String("exclude"),
Exclude: c.StringSlice("exclude"),
}
os.Exit(run(runConfig, showHelp))
}
Expand All @@ -92,7 +92,7 @@ func run(c runConfig, showHelp func()) int {
}
}
outputDirectory := c.OutputDir
exclusions := []string{c.Exclude}
exclusions := c.Exclude
suffix := core.Timestamp()
targetFilePath, err := resolveOutputPath(inputDirPath, suffix, outputDirectory)
if noop {
Expand Down Expand Up @@ -137,7 +137,7 @@ func main() {
cli.BoolFlag{Name: "quiet, q", Usage: "quiet mode"},
cli.BoolFlag{Name: "verbose, V", Usage: "verbose mode"},
cli.StringFlag{Name: "out, o", Usage: "output directory"},
cli.StringFlag{Name: "exclude, x", Usage: "exclude path"},
cli.StringSliceFlag{Name: "exclude, x", Usage: "exclude path"},
}
app.Action = mainAction
app.Run(os.Args)
Expand Down
5 changes: 5 additions & 0 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ Zipping /home/enrico/Projects/zipp/testdata
Completed /home/enrico/Projects/zipp/testdata-20210227173843.zip
----
It is possible to exclude files from zip:
----
$ zipts -x '\.git/*' -x 'vendor/*' .
----
## License
Expand Down

0 comments on commit 47679ca

Please sign in to comment.