Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Dec 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add Regex section
  • Loading branch information
TD-Sky committed Sep 13, 2023
commit b544416d9926c283235c59416c5dc3f6489ec630
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ For example:
```bash
mcfly dump --since '2023-01-01' --before '2023-09-12 09:15:30'
```

It will dump the commands run between *2023-01-01 00:00:00.0* to *2023-09-12 09:15:30*(**exclusive**) as **json**.
will dump the command run between *2023-01-01 00:00:00.0* to *2023-09-12 09:15:30*(**exclusive**) as **json**.
You can specify **csv** as dump format via `--format csv` as well.

Each item in dumped commands has the following fields:
Expand All @@ -228,19 +227,38 @@ mcfly dump
```

### Timestamp format

McFly use [chrono-systemd-time-ng] parsing timestamp.

**chrono-systemd-time-ng** is a non-strict implementation of [systemd.time](https://www.freedesktop.org/software/systemd/man/systemd.time.html), with the following exceptions:
* time units **must** accompany all time span values.
* time zone suffixes are **not** supported.
* weekday prefixes are **not** supported.

**Users of McFly simply need to understand specifying timezone in timestamp isn't allowed**.
Users of McFly simply need to understand **specifying timezone in timestamp isn't allowed**.
McFly will always use your **local timezone**.

For more details, please refer to [the document of chrono-systemd-time-ng][chrono-systemd-time-ng].

[chrono-systemd-time-ng]: https://docs.rs/chrono-systemd-time-ng/latest/chrono_systemd_time/

### Regex
*Dump* supports filtering commands with regex.
The regex syntax follows [crate regex](https://docs.rs/regex/latest/regex/#syntax).

For example:
```bash
mcfly dump -r '^cargo run'
```
will dump all command prefixes with `cargo run`.

You can use `-r/--regex` and time options at the same time.

For example:
```bash
mcfly dump -r '^cargo run' --since '2023-09-12 09:15:30'
```
will dump all command prefixes with `cargo run` ran since *2023-09-12 09:15:30*.

## Settings
A number of settings can be set via environment variables. To set a setting you should add the following snippets to your `~/.bashrc` / `~/.zshrc` / `~/.config/fish/config.fish`.

Expand Down
Loading