Package: shell-whiz
Shell Whiz is an AI assistant for the command line. It will help you find the right command for your task.All featuresCommand suggestions:It suggests shell commands based on your input. For example, if you want to know the timestamp of a file,?? what is the timestamp of file.txtwill suggeststat -c %y file.txt, which will print the last modification time of the file.Command explanations:It will try to explain, piece by piece, what the suggested command will do, so you can learn new things about your shell and the commands you use.Revisions:If the suggested command is not quite what you want, you can ask for a revision. Another way to use this feature is to start with a simple query and iteratively create a complex command by defining the details.Customization:You can tweak the behavior of Shell Whiz using command line arguments. For example, you can set PowerShell as your shell, disable automatic explanations, or use anyChat Completionsmodel instead of the defaultgpt-3.5-turbo-0125model.Installation and setupTo install Shell Whiz, run the following command:pipinstallshell-whizThis will add theswcommand to yourPATH.To use Shell Whiz, you need an API key from OpenAI. Obtain this key by visitinghttps://platform.openai.com/account/api-keys. Once you have the key, configure Shell Whiz by running the following command:swconfigFree API plan for new usersNew users receive $5 for free to try and test the API during the first 3 months. However,it is recommended to upgrade to a paid plan in order to have a more comfortable experience using Shell Whiz. This is because the free plan has restrictions on the number of requests allowed per minute.UpgradingTo upgrade Shell Whiz, run the following command:pipinstall--upgradeshell-whizUsageYou can run Shell Whiz directly usingsw ask, but I recommend creating an alias for it. For example, you can add the following line to the bottom of your~/.bashrcfile:alias??='sw ask'You can also create a function instead of an alias. This will allow you to save executed commands in history. Here are the functions for Bash and Zsh:# ~/.bashrcwhiz-shell(){TMPFILE=$(mktemp)trap'rm -f $TMPFILE'EXITifswask-o"$TMPFILE""$@";thenif[-e"$TMPFILE"];thenSW_CMD=$(cat"$TMPFILE")history-s$(history1|cut-d' '-f4-)history-s"$SW_CMD"eval"$SW_CMD"elseecho"Sorry, something went wrong."fielsereturn1fi}alias'??'='whiz-shell'# ~/.zshrcwhiz-shell(){TMPFILE=$(mktemp)trap'rm -f $TMPFILE'EXITifswask-o"$TMPFILE""$@";thenif[-e"$TMPFILE"];thenSW_CMD=$(cat"$TMPFILE")print-s"$SW_CMD"eval"$SW_CMD"elseecho"Sorry, something went wrong."fielsereturn1fi}alias'??'='whiz-shell'PowerShell users can create a function in theirPowerShell profile.function??{# Don't forget to set path to your PowerShell executable# GPT-4 is used because other models don't work well with PowerShellswask--dont-warn`-s<powershellexecutablepath>`-mgpt-4`-p"I use PowerShell"`@Args}To track API usage and costs, periodically visit theOpenAI API Usagepage.TipsTo pass an argument beginning with a hyphen, use the--delimiter. This separates the command and its arguments. For example,sw ask -- emulate ARM kernel on versatilepb architecture -cpu cortex-a8.Specify a shell executable using-sor--shell.To select thegpt-4model, include-m gpt-4or--model gpt-4.To use the GPT-4 model for explanations, append--explain-using gpt-4.To disable automatic explanations, include-nor--dont-explain. Manual explanations can still be requested via the menu.Use--dont-warnto turn off automatic warnings.Set specific preferences by adding-p "..."or--preferences "...". This setting is versatile, useful for choosing a shell environment or other preferences, including the language for assistant responses. The default isI use Bash on Linux.Add-qor--quietto hide the menu and finish right away.I prefer usingalias ??='sw ask --dont-warn -n --', but when I encounter a command that I don't fully understand, I choose to explain it using GPT-4 manually.You should choose the settings that work best for you.Highly recommend usingIntelliShell(a bookmark store for commands) along with Shell Whiz.More examplesLicenseShell Whiz is licensed under the GNU General Public License v3.0.