Usage: whenwasit [options] PATH
little thing meant to be called in a git-hook as to keep track of file creation and modification dates, which are important to me. dumps csv output on stdout, errors abort with a panic (this will be fixed later).
Use the --format
flag (-f
) to switch between outputting
json
or csv
. the default is csv
.
The flag --ignore
can be used to ignore paths relative to
the one whenwasit was given. See .whenwasit-ignore
as an example.
For an example on how you might use whenwasit as a git hook, see pre-commit. It runs whenwasit before commit, makes the file times.csv, and adds it to the commit.
CSV Output Definition:
because there are varying ways to make a CSV, it's described in detail below.
- there is no header; the first row is data
- the data rows are in the format
path,btime,mtime,atime
path
: file path relative to the root that was provided on the command linebtime
: time of file creation; birth timemtime
: time file was last modifiedatime
: time file was last accessed
- if the
path
contains a comma (,
) or a backslash (\
), it is escape with a backslash - if any one of the time cannot be attained, the field is left empty.
behavior:
prints a row for the current directory, a row for each file, and
then goes into each directory recursively.
this results in reading the directory twice as to not cache the directory listings in memory.