From 61f66dfa0d79495c10d6a8db1a416c5da17dd3ca Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Tue, 28 Oct 2025 14:18:12 +0000 Subject: [PATCH] `zip`: add `--include` option Members of zip files passed to `--include` will be included in the output archive before any that are members of zip files discovered in the input directories that satisfy the `--suffix` options. --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index 28f9a29..52b2738 100644 --- a/main.go +++ b/main.go @@ -44,6 +44,7 @@ var opts = struct { Zip struct { In flags.StdinStrings `short:"i" long:"input" description:"Input directory" required:"true"` Out string `short:"o" long:"output" env:"OUT" description:"Output filename" required:"true"` + Include []string `long:"include" description:"Add members of these zip files to generated zip file (before any others)"` Suffix []string `short:"s" long:"suffix" default:".jar" description:"Suffix of files to include"` ExcludeSuffix []string `short:"e" long:"exclude_suffix" description:"Suffix of files to exclude"` ExcludeTools []string `long:"exclude_tools" env:"TOOLS" env-delim:" " description:"Tools to exclude from the generated zipfile"` @@ -221,6 +222,9 @@ func main() { defer pf.Close() must(f.WritePreamble(pf)) } + for _, filename := range opts.Zip.Include { + must(f.AddZipFile(filename)) + } if opts.Zip.MainClass != "" { must(f.AddManifest(opts.Zip.MainClass)) }