ohshit

Oh Shit! is the command fixer you didn't know you needed. Inspired by thefuck.

Oh Shit!

This app was heavily inspired by nvbn/thefuck, so credit where credit is due. That being said, Oh Shit! aims to be an even more powerful, fast, and gratifying way to correct your shell mistakes. Since Oh Shit! is written in Crystal you should see a significant speed increse, and you don't need to worry about any Python!

Note: This is still in development. The below instructions do not work yet.

Installation

For now, installation will require cloning this repo and building yourself. Binaries will be available in the future.

cd /opt
git clone https://github.com/watzon/ohshit
cd ohshit
crystal build --release
sudo ln -ls /opt/ohshit/bin/ohshit /usr/local/bin/ohshit
ohshit set-aliases

The set-aliases command will set an alias in your .bashrc and .zshrc files, allowing you to run Oh Shit! with the shit command instead of ohshit. To do this manually add the following to your shell configuration files.

alias shit='ohshit'

Don't forget to reload your configuration any time you make a change.

source ~/.zshrc

Usage

Whenever you run an incorrect command on your terminal just follow it up with shit to have your mistake instantly corrected.

Examples

➜ pacman -S vim
error: you cannot perform this operation unless you are root.

➜ shit
sudo pacman -S vim [enter/↑/↓/ctrl+c]
[sudo] password for watzon:
resolving dependencies...
...
➜ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


➜ shit
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 2, done.
...
➜ git brnch
git: 'brnch' is not a git command. See 'git --help'.

The most similar command is
	branch

➜ shit
git branch [enter/↑/↓/ctrl+c]
* master

Development

Feel free to help with issue tracking by submitting an issue if you run into one. Do remember that this is alpha software and comes with no assurances that it will work correctly.

Alternatively you can always fork this repo and do some coding yourself. I open all contributions and appreciate the effort.

Contributing

  1. Fork it (https://github.com/watzon/ohshit/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

ohshit

Owner
Statistic
  • 2
  • 0
  • 0
  • 0
  • 0
  • over 5 years ago
  • May 18, 2019
License

MIT License

Links
Synced at

Sun, 22 Dec 2024 09:48:24 GMT

Languages