dropbox / dbxcli

A command line client for Dropbox built using the Go SDK
Other
1.05k stars 101 forks source link

Add option to output file size and date/times in a machine readable format #139

Open athena-metis opened 4 years ago

athena-metis commented 4 years ago

The usual command flag would be -h to make it human readable but as this is already the default behaviour implementing it in this way would require a change to existing functionality that others may rely on. This change is to add a slightly less conventional switch to allow the output to be more friendly to integrating with scripts.

The change allows for a -m / --machine flag for rev/search/ls commands which will output the file size in bytes and the date in a standard format rather than "X hours ago" etc. This allows for use in scripts where you want to compare a file size or check the modified date (separate PR for maintaining this when uploading via the put command)

The -m / --machine switch implies -l / --long as the standard ls output doesn't include any humanised information anyway.

Existing long output

$ dbxcli ls -l
Revision              Size  Last modified Path
5a3f4f259f9d3554dee35 548 B 2 hours ago   /LICENSE
$ dbxcli ls -m
Revision              Size Last modified                 Path
5a3f4f259f9d3554dee35 548  2020-04-23 13:08:36 +0000 UTC /LICENSE
CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.