davidchalifoux / kaput-cli

The unofficial CLI client for Put.io - Kaput lets you manage your Put.io account from the comfort of your terminal!
https://kaput.sh/
MIT License
68 stars 7 forks source link

List --all option to list all files? #3

Closed plambert closed 4 years ago

plambert commented 4 years ago

It would be useful to have either an all command, or --all option to the list command, which would use the API feature to list all files by passing parent_id=-1.

Coupled with the option for JSON output, it'd make it easy to use jq and other tools to do complex queries.

There are some optional parameters to include additional metadata; it might make sense to enable them, since it's easier for the user to throw away information than to not have it at all.

Thanks for the awesome work!

Paul

davidchalifoux commented 4 years ago

Yes this is definitely something that I've planned on adding. I will probably make the additional metadata available by default on the JSON output, but not by default on the table view to keep it simple. Perhaps I'll add a flag to include it on the table view as well.

davidchalifoux commented 4 years ago

I've added support for this in commit https://github.com/davidchalifoux/kaput-cli/commit/79a7839f3b8d698b0ade28ed8d541a849ad1051a.

Passing the --all flag will return all files of the user. By default, there is a 1000 item limit on the API. So I've also added the --limit flag. If --limit -1 is used, the CLI will use the cursor to continue querying until all files are retrieved.

If you'd like to test this out before v0.0.2 is released, you can use the CLI by pulling from the main git branch and using ./bin/run.