nfriedly / node-bestzip

Provides a `bestzip` command that uses the system `zip` if avaliable, and a Node.js implimentation otherwise.
MIT License
81 stars 17 forks source link

CLI options for change working directory ? #50

Open abcfy2 opened 3 years ago

abcfy2 commented 3 years ago

Just like tar -C, this is used for one line command without cd:

$ bestzip -C dist ../dist.zip .

Also cpy-cli provide this option:

    Copy all .html files inside src folder into dist and preserve path structure
    $ cpy '**/*.html' '../dist/' --cwd=src --parents
nfriedly commented 3 years ago

Hum, I'm not sure. I try to keep the command-line arguments on bestzip to a subset of those on the native zip command, and mine doesn't appear to have one for changing the CWD. Also, that can be handled by just doing a cd into the appropriate directory first.

melgish commented 2 years ago

Controlling the CWD from the outside means any actions after bestzip have to account for the folder change.

build && cd dist && bestzip ../output.zip ./* && cd .. && deploy output.zip

vs

build && bestzip -C dist ../output.zip ./* && deploy output.zip

To me, the first, while it works, is less elegant.