Shell Whiz is an AI assistant for the command line. It will help you find the right command to solve your task. This way, you can save your time and effort without diving into documentation, man pages, or searching the web.
Installation 🛠️
To install Shell Whiz, run the following command:
pip install shell-whiz
Or, if you prefer to use pipx:
pipx install shell-whiz
This will add the sw command to your PATH.
To use the assistant you'll need an API key from OpenAI. Obtain this key by visiting https://platform.openai.com/api-keys. Once you have the key, you can set it either by running sw config or by setting the OPENAI_API_KEY environment variable.
Getting started ✨
You can run the assistant directly using sw ask, but I recommend creating an alias for it. For example, you can add the following line to the bottom of your ~/.bashrc file:
alias '??'='sw ask'
PowerShell users can create a function in their PowerShell profile.
function ?? {
sw ask `
-s (Get-Command powershell.exe).Source `
-m gpt-4o `
-p "I use PowerShell on a daily basis" `
@Args
}
You can also create a function that allows you to save executed commands in history. Here are the functions for Bash and Zsh:
# ~/.bashrc
whiz-shell() {
TMPFILE=$(mktemp)
trap 'rm -f $TMPFILE' EXIT
if sw ask -o "$TMPFILE" "$@"; then
if [ -e "$TMPFILE" ]; then
SW_CMD=$(cat "$TMPFILE")
history -s $(history 1 | cut -d' ' -f4-)
history -s "$SW_CMD"
eval "$SW_CMD"
else
echo "Sorry, something went wrong." >&2
fi
else
return 1
fi
}
alias '??'='whiz-shell'
# ~/.zshrc
whiz-shell() {
TMPFILE=$(mktemp)
trap 'rm -f $TMPFILE' EXIT
if sw ask -o "$TMPFILE" "$@"; then
if [ -e "$TMPFILE" ]; then
SW_CMD=$(cat "$TMPFILE")
print -s "$SW_CMD"
eval "$SW_CMD"
else
echo "Sorry, something went wrong." >&2
fi
else
return 1
fi
}
alias '??'='whiz-shell'
To track API usage and costs, periodically visit the OpenAI API Usage page.
Advanced usage 🚀
The assistant can be easily configured for any task using command line arguments.
The most powerful option is -p "..." or --preferences "...". This setting can be used to select the shell environment or even the language of the assistant's responses. The default value is I use Bash on Linux.
Run sw ask --help for more information.
Metadata
Release files for shell-whiz 3.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shell_whiz-3.2.6.tar.gz | 24.6 kB | Without provenance | Details for shell_whiz-3.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shell_whiz-3.2.6-py3-none-any.whl | Python 3 | none | any | Details for shell_whiz-3.2.6-py3-none-any.whl |
Total release size: 53.8 kB
Release files / shell_whiz-3.2.6.tar.gz
| Download URL | shell_whiz-3.2.6.tar.gz |
|---|---|
| Size | 24.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
121c8cb1d2fb82a70b274466318008edee04579cb7e076bed6b4d0706fb054fe
|
|
BLAKE2b-256 checksum How to use checksums |
a34f99def705510317b2a4885ecb832f4bc52c1943da57c7227dc7c1586b9401
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.15 Linux/6.5.0-1025-azure
|
Release files / shell_whiz-3.2.6-py3-none-any.whl
| Download URL | shell_whiz-3.2.6-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf25401da400251161b348fc7a2a6540e44b3a97db1368a30ec9a21536ef7418
|
|
BLAKE2b-256 checksum How to use checksums |
19245444fc8d86b56d4ace456dd98c89ea935d09ad9903d183ed0ea658ab1b30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.15 Linux/6.5.0-1025-azure
|
Security for shell-whiz 3.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.