Skip to main content

Command generation tool

Project description

๐Ÿš€ CommandGen: Your AI-Powered Terminal Buddy

Ever wished you had a tech wizard in your terminal? ๐Ÿง™โ€โ™‚๏ธโœจ
Tired of Googling how to use grep or find? ๐Ÿฅด
Fear not, CommandGen is here! ๐ŸŽ‰

CommandGen is your AI-powered terminal assistant that translates plain English into shell commands using the Google Gemini API. Just describe what you need, and CommandGen will generate and (optionally) run the command for you! ๐Ÿ–ฅ๏ธโšก

๐Ÿ”ฅ Features

โœ… Natural Language Magic โ€“ No more awk-ward moments, just type what you want!
โœ… Preview Before You Wreck โ€“ Avoid accidental rm -rf / disasters. ๐Ÿ˜ฌ
โœ… Custom Shell Support โ€“ Bash? Zsh? Fish? We got you. ๐Ÿ 
โœ… Clipboard & Save Options โ€“ Because typing is hard. ๐Ÿคท
โœ… Command History โ€“ Never forget that genius one-liner again. ๐Ÿ“
โœ… Configurable & Secure โ€“ Your API key stays safe. ๐Ÿ”


โš™๏ธ CLI Options

  -q, --query       ๐Ÿ’ฌ Your natural language command request.
  --run             ๐Ÿš€ Executes the command immediately (with confirmation).
  --shell           ๐Ÿš Specify a shell (bash, zsh, fish).
  --history         ๐Ÿ“œ View past generated commands.
  --copy            ๐Ÿ“‹ Copy command to clipboard.
  --save FILE       ๐Ÿ’พ Save the generated command to a file.
  --json            ๐Ÿ“ฆ Output the generated command in JSON format.
  --setup           ๐Ÿ”ง Run interactive setup for API key and model selection.
  --version         ๐Ÿท๏ธ Show the current version of CommandGen.

๐Ÿ“ฆ Installation

git clone https://github.com/freemarketamilitia/cmdgen.git
cd commandgen
pip install -e .

๐Ÿš€ cmdgen: Your AI-Powered CLI Assistant

Run Terminal Commands Like a Wizard! ๐Ÿง™โ€โ™‚๏ธโœจ

cmdgen is a command-line tool powered by the Google Gemini API that converts natural language into terminal commands. No more Googling weird syntaxโ€”just ask, confirm, and run.


๐Ÿ”ง Setting Up cmdgen as a Global Command

Want to run cmdgen from anywhere instead of typing python cli.py? Hereโ€™s how! ๐Ÿ› ๏ธ


๐Ÿ› ๏ธ 1๏ธโƒฃ Rename cli.py to cmdgen (Optional)

Make your script executable:

mv cli.py cmdgen
chmod +x cmdgen  # Make it executable

๐Ÿ”— 2๏ธโƒฃ Move It to a Directory in Your System PATH

Move the script to a directory already in $PATH, such as /usr/local/bin on macOS/Linux or the user scripts directory on Windows.

๐Ÿ“Œ On macOS/Linux

mv cmdgen /usr/local/bin/

Now you can run:

cmdgen

from anywhere. ๐ŸŽ‰


๐Ÿ“Œ On Windows

  1. Find your Python scripts directory:
    python -c "import sys; print(sys.executable)"
    
  2. Copy cmdgen to this folder
  3. Add it to the PATH variable:
    • Open Control Panel โ†’ System โ†’ Advanced System Settings
    • Click Environment Variables
    • Find Path under System Variables โ†’ Click Edit
    • Click New and paste the path of the directory containing cmdgen
    • Click OK, close everything, and restart your terminal.

Now you can run:

cmdgen

from anywhere on Windows! ๐ŸŽ‰


๐Ÿ“ข Test It Out!

After adding cmdgen to your path, test it by running:

cmdgen --help

If it works, youโ€™re all set! ๐Ÿš€


๐Ÿ’ก Bonus: Add Autocomplete

For an even smoother experience, add shell autocomplete:

Bash/Zsh (Mac/Linux)

echo 'complete -W "$(cmdgen --help)" cmdgen' >> ~/.bashrc
source ~/.bashrc

PowerShell (Windows)

Set-PSReadLineOption -PredictionSource History

Now enjoy AI-powered command generation with cmdgen! ๐Ÿš€๐Ÿ”ฅ


๐Ÿ› ๏ธ How to Use

Just ask CommandGen like a normal human:

commandgen -q "list all files in the current directory"

โžก๏ธ This outputs:

ls

Simple, right? No more Stack Overflow rabbit holes! ๐Ÿ•ณ๏ธ๐Ÿ‡



๐Ÿ† Why Use CommandGen?

๐Ÿš€ Boost Productivity โ€“ No more wasting time figuring out syntax.
๐Ÿ˜Ž Look Like a Pro โ€“ Impress your coworkers with obscure one-liners.
๐Ÿ›ก๏ธ Safer Execution โ€“ Always review before running.


๐Ÿค– Under the Hood

CommandGen uses Google Gemini API to convert plain English into accurate shell commands.
The generated command is previewed before execution for safety.


๐Ÿค Contributing

Want to improve CommandGen? Found a bug? PRs welcome! ๐Ÿš€
Clone the repo, make changes, and submit a pull request.

git clone https://github.com/yourusername/commandgen.git
cd commandgen

๐Ÿ“ License

MIT License. Use it, improve it, but donโ€™t blame us if you rm -rf / your system. ๐Ÿ˜†

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmdgen-2.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmdgen-2.0.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file cmdgen-2.0.0.tar.gz.

File metadata

  • Download URL: cmdgen-2.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for cmdgen-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e66bf55ce23bbb906553dca38873e473ab29e68c091cc4d6b6b175b1c6588849
MD5 699d28d128a7d871f6407e20bf42743a
BLAKE2b-256 788ecdb5becac133148d6fd5d61beccd38c744379ff99e1da15a49d95e0527b8

See more details on using hashes here.

File details

Details for the file cmdgen-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: cmdgen-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for cmdgen-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50e200005d99431ca54b0e236a01de13adc123120a57bf48b52cf5c125f9c603
MD5 7c14128d6ec91b8061d5bf6400c12f23
BLAKE2b-256 f6bd7de28c3b21d834869bd7b3f6307430fe81a6def95627030ba163094b0d1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page