78 Commits

Author SHA1 Message Date
nathan dawit
d8336bc2f3 Merge pull request #31 from frectonz/main
fix extracting commands from fish history
2023-04-01 21:19:23 +03:00
frectonz
2a950cc647 fix extracting commands from fish history 2023-04-01 21:13:29 +03:00
nathan dawit
b81e62ca47 fix: readded the --file option
if it failes to find the HISTFILE env var, it prompts the user for it
2023-03-16 16:57:59 +03:00
nathan dawit
06d6487ec1 Use crossterm 2023-03-15 17:41:50 +03:00
nathan dawit
f1be855d8f refactor: use PrintStyled 2023-03-15 17:36:42 +03:00
nathan dawit
c924c0a6d2 refactor: use crossterm 2023-03-15 17:16:51 +03:00
nathan dawit
f4e404b466 docs: update readme 2023-03-15 09:05:22 +03:00
nathan dawit
35b638a3e3 Merge pull request #28 from nate-sys/refactor
Refactor
2023-03-15 08:59:04 +03:00
nathan dawit
bd9cf2bb08 refactor: fix behaviour with regexp arg
if regex is specified use it, else, use shell strat
2023-03-15 08:53:54 +03:00
nathan dawit
1a5150453e refactor: display extra information
display total and "others" in output
2023-03-14 20:51:28 +03:00
nathan dawit
83b2387d55 fix: remove unnecessary trailing '...' 2023-03-14 15:19:36 +03:00
nathan dawit
a4a61fac82 refactor: rethink how the bar arg works 2023-03-14 15:01:42 +03:00
nathan dawit
ccc96ab798 feat: get histfile from env var
also remove some redundant args
2023-03-14 14:09:33 +03:00
nathan dawit
29a9c8573d refactor: improve performance
only instantiate the regex struct once.
2023-03-14 13:46:53 +03:00
nathan dawit
abf4e88373 refactor: run cargo clippy 2023-03-13 20:17:40 +03:00
nathan dawit
445989a90e refactor: be more "idiomatic"
trying to make use of more idiomatic datatypes and stuff but got too
carried away. result is more accurate but extremely slow and probably
redundant in many places. also not KISS
2023-03-13 20:08:03 +03:00
nathan dawit
7181ee7ec0 chore: run cargo clippy 2023-03-13 09:31:39 +03:00
nathan dawit
dcda90febd refactor: modified some fns and added tests
use regex for quoted string detection
2023-03-13 09:20:44 +03:00
nathan
d651dcf907 chore: add screenschot 2023-01-17 11:51:49 +03:00
nathan
48b750ee4c feat: recognize leaders and subcommands
[x] leader commands like git will be counted, but their subcommands (i.e
status, commit, add) will be ignored

[x] leader commands like sudo and does will be counted along with their
subcommands

[x] code is messier
2023-01-17 11:21:58 +03:00
nathan dawit
1c7b988ca1 Merge pull request #27 from Arkaeriit/swifter_unquoting
Fix bug when history with no quotes were not read.
2022-12-30 20:55:44 +03:00
Maxime Bouillot
fbf2f63811 Fix bug when history with no quotes were not read.
The bug was introduced in d2d760c. My bad.
2022-12-30 16:58:51 +01:00
nathan dawit
03b61b2b6a Merge pull request #26 from Arkaeriit/swifter_unquoting
Cleanup _remove_quoted_strings
2022-12-30 12:03:25 +03:00
Maxime Bouillot
df3f5ad26a Cleanup _remove_quoted_strings
Nullishamy's advice leads to cleaner and more
concise code.
2022-12-30 09:40:46 +01:00
nathan dawit
b15b06b5ee Merge pull request #25 from nullishamy/fix/hash
Fix hash
2022-12-30 10:48:32 +03:00
nathan dawit
719823b99b Merge pull request #24 from Arkaeriit/swifter_unquoting
Swiften the quote removing process
2022-12-30 05:53:38 +03:00
nullishamy
ef68322694 Fix hash 2022-12-30 01:44:05 +00:00
Maxime Bouillot
d2d760cc7a Swiften the quote removing process
A more careful use of memory leads to a way
faster processing on very larges histories. I saw
a 45x speed increase on the history of my work
computer. Furthermore, the memory usage is also
reduced.

The behavior does not changes otherwise.
2022-12-29 23:38:25 +01:00
nathan dawit
076a6fe64a Merge pull request #23 from Arkaeriit/fish_flag_but_good
Fix fish shell flag
2022-12-29 21:36:44 +03:00
Maxime Bouillot
f36e268a93 Fix fish shell flag
This flag now can implicitly use the needed
prefix to parse the fish history.
2022-12-29 18:31:02 +01:00
nate-sys
cd06b6faad chore: run cargo clippy 2022-12-29 14:11:45 +03:00
nate-sys
4b22d560e2 chore: remove let ... else statement
remove a `let ... else` pattern in order for it to compile on earlier
rust versions.
fixes #20
2022-12-28 16:44:13 +03:00
nate-sys
cf4fdec222 chore: add rust workflow
added an action that runs cargo check on commits and pr's
2022-12-28 08:25:59 +03:00
nate-sys
0f3a48f863 fix: error after merging 2022-12-28 08:18:08 +03:00
nathan dawit
8fe444b604 Merge pull request #11 from 9glenda/main
Readme extra instruction for nixos
2022-12-28 08:05:50 +03:00
nathan dawit
e99a7a4410 Merge pull request #18 from Arkaeriit/quoted_arguments
Remove quoted strings from command inputs.
2022-12-28 07:27:10 +03:00
nathan dawit
b75c626866 Merge branch 'main' into quoted_arguments 2022-12-28 07:26:59 +03:00
nathan dawit
dab18ed8e6 Merge pull request #16 from anemovva/main
Add better support for ZSH and adds the regex dependency
2022-12-28 07:07:16 +03:00
Aneesh
66170f2ff8 Added options to make a few of the most common shells work with a simple '--shell=shellname' option. Also updated the README with updated instructions for Zsh and Fish 2022-12-27 15:31:54 -07:00
Maxime Bouillot
5fbf064f98 Remove quoted strings from command inputs.
Before this commit, commands were cut whenever a
separator char was encountered. Unfortunately,
when those chars are used as the arguments of a
function, some text is mistaken for a new
command. For me, this manifests itself as URL
chunks being interpreted as commands.

```
[▮▮▮       ]  2.07%  87 ?xt=urn
[▮▮▮       ]  1.81%  76 tr=udp%3A%2F%2F
```

This commits makes every quoted string ignored so
that such false commands no longer happen.
A similar process still needs to be applied for
escaped separators.
2022-12-27 23:30:28 +01:00
Aneesh
013033b803 Added option to change the regex being removed to make it easier to account for varying prefixes in differet shells. Still defaults to the zsh prefix though. 2022-12-27 14:36:32 -07:00
Aneesh
0020807d19 Fixed issue with muc not being able to handle zsh history prefixes. Added regex dependency 2022-12-27 11:33:57 -07:00
nathan dawit
1876688fbf Merge pull request #13 from Arkaeriit/fix_prefix
Fix prefix use
2022-12-27 20:19:16 +03:00
Maxime Bouillot
7b90ff2757 Fix prefix use
The prefix argument was not handled properly
which cause outputs from fish history to look
like that:
```
$ HISTFILE=~/.local/share/fish/fish_history ./target/debug/muc --file $HISTFILE --count 3 --prefix="- cmd: " --pretty
[▮▮▮▮▮▮▮▮▮▮] 43.42% 3623 -
[▮▮▮▮▮▮    ] 27.85% 2324 when:
[▮▮▮       ] 13.46% 1123 paths:
```

This commit makes it look like that:
```
$ HISTFILE=~/.local/share/fish/fish_history ./target/debug/muc --file $HISTFILE --count 3 --prefix="- cmd: " --pretty
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
[▮▮▮▮▮▮▮▮▮▮]  6.17% 222 cd
[▮▮▮▮▮▮▮▮  ]  5.01% 180 vim
[▮▮▮▮▮▮▮   ]  4.51% 162 ls
```

This is the desired behavior.
2022-12-27 15:39:28 +01:00
nate-sys
d4bb4c6520 fix: account for the colon operator
fixes #10
2022-12-27 17:25:44 +03:00
nathan dawit
53289d93ee Merge pull request #12 from Arkaeriit/fix_small_size_count
Prevent index error
2022-12-27 17:04:35 +03:00
9glenda
e4c295b41f feedback 2022-12-27 14:04:15 +00:00
Maxime Bouillot
5b949dbb2f Prevent index error
When the given count arg was bigger than the size
of the history, an index error occurred. This
commit fixes that issue.
2022-12-27 15:01:07 +01:00
9glenda
041e628e60 fmt 2022-12-27 13:07:55 +00:00
9glenda
c02799cd30 flake compat 2022-12-27 12:33:37 +00:00