sheepy0125 / command-is-now-found

MIT License
2 stars 0 forks source link

Auto detect command to run #1

Open sheepy0125 opened 2 years ago

sheepy0125 commented 2 years ago

I'd like the implementation to give the user a list of the most recent 5 commands run and then use the first word of their choice as the command. I was planning to add this, however, there seems to be no existing way to parse history files across different shells.

For example: bash's history file is at ~/.bash_history and is just a list of commands, zsh's history file is at ~/.zsh_history with a list of commands prefaced with a timestamp, and fish's history file is at ~/.local/share/fish/fish_history with 2 lines per command run (one with a timestamp). Not to mention some shells use a SQL-based history file!

Maybe this could just support a few shells (bash, fish, and zsh)?

sheepy0125 commented 1 year ago

As a compromise, I think an acceptable alternative would to let the user pass in the full command they tried to run that didn't work using !! and then just take the first value passed in -c.