FLEM is a command-line tool that helps fix bash commands. It retrieves the last executed bash command from your history, sends it to GPT for correction, and then allows you to execute the corrected command.
- Ultra simple
- No external dependencies
-
Clone this repository:
git clone https://github.com/yourusername/flem.git cd flem
-
Set up your OpenAI API key as an environment variable:
export FLEM_OPENAI_API_KEY='your-api-key-here'
Run the script with:
python flem.py [options]
It's recommended to define an alias instead:
alias flem='history -w;python3 /path/to/flem.py'
Options:
-v
,--verbose
: Enable verbose output-h
,--help
: Show the help message and exit
- The script checks for potentially dangerous commands (e.g.,
rm
,dd
,mkfs
) and asks for confirmation before executing them. - The OpenAI API call is configured with a low temperature setting to reduce randomness in the output.