tywil04 / slavartdl

Simple tool written in Go(lang) to download music using the SlavArt Divolt server
GNU General Public License v3.0
18 stars 1 forks source link

Flexibility feature request #4

Closed bacon-cheeseburger closed 1 year ago

bacon-cheeseburger commented 1 year ago

Hi,

I'd like to make a few suggestions I think would be beneficial to users.

  1. Add a command line option to set the location of the config file, or a full path to an alternate config file without a hardcoded filename. ie: "-c|--config-dir /some/other/config/dir" or "-cf|--config-file /path/to/my/config/archive/slavartdl.json"

Or, a single command line option could be used. If the supplied arg is a dir, only set the config file path and use the default config filename. If the supplied arg ends with a filename, set both the config path and config filename to use. ie: "-C|--config /path/to/config/dir" would use "/path/to/config/dir/config.json" "-C|--config /path/to/config/dir/slavartdl.json" would use "/path/to/config/dir/slavartdl.json"

  1. Add a command line option to (en|dis)sable automatic unzipping of the downloaded file. ie: "-u|--unzip" or "-nu|--no-unzip"

  2. Add the program version number to the built-in -h|--help. Currently it looks like:

    $ slavartdl slavartdl

    Usage: ...

But afterwards could look like:

$ slavartdl slavartdl 1.0.8

Usage: ...

Thanks for considering these suggestions!

tywil04 commented 1 year ago

I think rather than having the version being part of the help command, It would be better as a version command, that is not only easier to implement I think it makes more sense.

tywil04 commented 1 year ago

To build on the config flag, I think it would be useful to make the configuration do more than only hold session tokens. I am thinking that all command line flags (other than --config-dir and maybe some others) should be able to set in the config so they are global. Flags passed into commands will override the config (default or provided).

bacon-cheeseburger commented 1 year ago

Putting version in a command instead sounds good. Also expanding the config file to be more robust is a good idea as well! Another thought is allowing a user to pass a session token on command line and not even store it in a file. A usage example is bypassing a browser completely and using curl to get a dedicated token for slavartdl to use. Then if you log out of the browser, or don't even log in, it doesn't matter. Doing that makes it real easy for users who prefer ssh/command line, especially if the system they use is a remote box.

tywil04 commented 1 year ago

I don't think its necessary to allow passing a session token via the command line. If you need to add a session token, you can run slavartdl config add tokens <token> -C <custom config> and this will add the session token to your custom config.

tywil04 commented 1 year ago

v1.1.1

New Commands: version: Which simply displays the version of the current executable.

New Flags: -z, --skipZip: Skips unzipping the download archive, they get placed in the output directory. The name is sort of guessed because there is no way for me to get an accurate name. If the naming becomes an issue in the future I will switch to randomly generated names.

-C, --configPath: Override config path. This config can be overridden by flags used on a per command basis.

Regarding wanting a flag to allow session tokens to be passed via the command line, I don't think it would be useful. I can't think of any situation where that would be required because slavartdl config add tokens <token> -C <custom config> doesn't cut it. I do, however, have an open mind so if you can think of some suitable use cases I can consider adding the flag in the future.