pillsilly / recursive-unzipper

3 stars 2 forks source link

feat: make -f optional #8

Closed lucasgonze closed 1 year ago

lucasgonze commented 1 year ago

The program has one required argument, a file to unzip. recursive-unzipper myfile.tgz should do something useful.

But the program requires -f before the filename. This adds verbosity with little benefit.

Feature request: if -f is omitted, assume the remaining parameter is a file.

pillsilly commented 1 year ago

The program has one required argument, a file to unzip. recursive-unzipper myfile.tgz should do something useful.

But the program requires -f before the filename. This adds verbosity with little benefit.

Feature request: if -f is omitted, assume the remaining parameter is a file.

Thanks for the idea I did have the same idea for such improvement but wasn't sure about the common pattern about handling cli args mixing "with" and "without" dash

I would could try to investigate a little bit further when I have time🙂

Will be appreciated if any PR from the others.

lucasgonze commented 1 year ago

I am poking around in the Commander API. I haven't yet found a clean way to do it.

lucasgonze commented 1 year ago

I have some understanding of what to do with Commander. Can you document the assumptions to run in a dev environment? There is no "run" script.

pillsilly commented 1 year ago

I have some understanding of what to do with Commander. Can you document the assumptions to run in a dev environment? There is no "run" script.

I studied it a little bit as well and it seems "arguments" is what we're looking for.

Implementation would be like: https://github.com/pillsilly/recursive-unzipper/pull/10/files

outcome is to support appointing fie with or without -f like recursive-unzipper myzip.zip // new way or recursive-unzipper -f myzip.zip // old way

Also you reminded me to add a Development section to ease the others to try the code. At the moment you can simply use npm run test to run near-e2e tests

or /recursive-unzipper$ npx ts-node ./src/bin.ts -f abc.zip .... to execute the code directly.