From 933482294544283345e2215540d027022bac12c8 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 7 Sep 2024 00:27:27 -0700 Subject: [PATCH] fix: correct parsing of the files without a flag --- src/native/cli.d | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/native/cli.d b/src/native/cli.d index 3bd0d17..54ff9a3 100644 --- a/src/native/cli.d +++ b/src/native/cli.d @@ -23,22 +23,20 @@ import argparse; ) struct Options { - @TrailingArguments string[] files; bool comment = false; string[] str; // (Deprecated) A list of files to minify (for backwards compatiblitity with getopt) string[] file; } -int actualMain(Options opts) @trusted +int actualMain(Options opts, string[] files) @trusted { try { // minify the given files - if (opts.files.length > 0 || opts.file.length > 0) + if (files.length > 0 || opts.file.length > 0) { - const auto files = opts.files ~ opts.file; - minifyFiles(files, opts.comment); + minifyFiles(files ~ opts.file, opts.comment); } // minify the given string and print to stdout @@ -62,4 +60,4 @@ int actualMain(Options opts) @trusted return 0; } -mixin CLI!Options.main!((args) { return actualMain(args); }); +mixin CLI!Options.main!((opts, unparsed) { return actualMain(opts, unparsed); });