Skip to content

Commit

Permalink
fix: correct parsing of the files without a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Sep 7, 2024
1 parent 2a1d078 commit 9334822
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/native/cli.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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); });

0 comments on commit 9334822

Please sign in to comment.