cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.75k stars 176 forks source link

feat(dump history): You can specify the time range, regex and format to dump #374

Closed TD-Sky closed 7 months ago

TD-Sky commented 10 months ago

Implementation of https://github.com/cantino/mcfly/issues/372.

Now you can dump the history. For example,

$ mcfly dump > history.json

will dump the whole history into json file.

Here are the options:

      --since <SINCE>    Select all commands ran since the point
      --before <BEFORE>  Select all commands ran before the point
  -s, --sort <ORDER>     Sort order [case ignored] [default: ASC] [possible values: ASC, DESC]
  -r, --regex <REGEX>    Require commands to match the pattern
  -f, --format <FORMAT>  The format to dump in [default: json] [possible values: json, csv]
  -h, --help             Print help

The timestamp (since/before) format is subject to chrono-systemd-time which is a non-strict implementation of systemd.time.


I think the PR isn't in the final stage now so suggestions are welcome.

cantino commented 9 months ago

Awesome, I'll test this out shortly. Thanks @TD-Sky

cantino commented 9 months ago

@TD-Sky would you be able to also update the mcfly help dump page and README with example usage and especially a timestamp example or format reference?

TD-Sky commented 9 months ago

Let me have a try.

TD-Sky commented 9 months ago

You could review README.md now.

Sorry for my delay, I'm busy these days.

Houlistonm commented 7 months ago

Any plans to merge?

TD-Sky commented 7 months ago

Any plans to merge?

chrono depreciated some APIs we are using. I may need to refactor chrono-systemd-time to adapt the correct APIs.

TD-Sky commented 7 months ago

Fixed.

cantino commented 7 months ago

Thank you @TD-Sky for this nice addition!

cantino commented 7 months ago

Released https://github.com/cantino/mcfly/releases/tag/v0.8.3