-
Notifications
You must be signed in to change notification settings - Fork 174
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
Feature: quick stats #330
Comments
I'd be happy to accept a pull request! |
Sure, I can add it to my todo list. |
nicokosi
added a commit
to nicokosi/mcfly
that referenced
this issue
Jun 3, 2024
As suggested in issue cantino#330, this commit introduces a "stats" command that displays quick stats like: $ cargo run --quiet -- stats 📊 Quick stats: - history has 51915 items. - has 10 distinct commands. - 10 first commands, sorted by occurrences: gco (2835) g (2451) z (2348) npm (2020) sdk (1908) git (1615) ./run-dev.sh (1490) cd (1334) docker (1225)
nicokosi
added a commit
to nicokosi/mcfly
that referenced
this issue
Jun 3, 2024
As suggested in issue cantino#330, this commit introduces a "stats" command that displays quick stats like: $ cargo run --quiet -- stats 📊 Quick stats: - history has 51926 items ; - 10 first commands, sorted by occurrences: gco (2835) g (2452) z (2348) npm (2020) sdk (1908) git (1616) ./run-dev.sh (1490) cd (1334) docker (1225)
nicokosi
added a commit
to nicokosi/mcfly
that referenced
this issue
Jun 4, 2024
Fix these Clippy warnings: cargo clippy Checking mcfly v0.8.6 (/Users/nicolas/work/mcfly) warning: useless use of `format!` --> src/stats_generator.rs:26:24 | 26 | lines.push_str(format!("📊 Quick stats:\n").as_mut_str()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"📊 Quick stats:\n".to_string()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format = note: `#[warn(clippy::useless_format)]` on by default warning: deref which would be done by auto-deref --> src/stats_generator.rs:29:24 | 29 | lines.push_str(&*Self::generate_command_stats( | ________________________^ 30 | | self, 31 | | limit, 32 | | most_used_commands, 33 | | )); | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref = note: `#[warn(clippy::explicit_auto_deref)]` on by default help: try | 29 ~ lines.push_str(&Self::generate_command_stats( 30 + self, 31 + limit, 32 + most_used_commands, 33 ~ )); | warning: accessing first element with `vec.get(0)` --> src/stats_generator.rs:82:9 | 82 | vec.get(0).unwrap().count | ^^^^^^^^^^ help: try: `vec.first()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first = note: `#[warn(clippy::get_first)]` on by default warning: `mcfly` (lib) generated 3 warnings (run `cargo clippy --fix --lib
nicokosi
added a commit
to nicokosi/mcfly
that referenced
this issue
Jun 5, 2024
Try to fix tests that used to depend on "real history from shell": test stats_generator::tests::empty_history ... FAILED test stats_generator::tests::full_history ... FAILED test stats_generator::tests::partial_history ... FAILED failures: ---- stats_generator::tests::empty_history stdout ---- McFly: Importing shell history for the first time. This may take a minute or two...thread 'stats_generator::tests::empty_history' panicked at src/shell_history.rs:62:17: McFly error: Please ensure HISTFILE or MCFLY_HISTFILE is set for your shell (environment variable not found)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be neat to add something like
mcfly stats
to the cli for the curious - it could be roughly equivalent toInspired by https://www.miskatonic.org/2023/02/21/commands/
The text was updated successfully, but these errors were encountered: