AI Shell自然語言轉(zhuǎn) shell 命令
AI Shell 是一個將自然語言轉(zhuǎn)換為 shell 命令的 CLI 。
設(shè)置
注意:Node.js 的最低支持版本是 v14
1. 安裝:
npm install -g @builder.io/ai-shell
2. 從 OpenAI 找到你的 API 密鑰
3. 設(shè)置你的 API
ai-shell config set OPENAI_KEY=<your token>
將在主目錄中創(chuàng)建一個 .ai-shell 文件。
用法
ai <prompt>
例如:
ai list all log files
然后你會得到這樣的輸出,你可以選擇運行建議的命令,通過提示修改命令,或者取消:
◇ Your script:
│
│ find . -name "*.log"
│
◇ Explanation:
│
│ 1. Searches for all files with the extension ".log" in the current directory and any subdirectories.
│
◆ Run this script?
│ ● ? Yes (Lets go!)
│ ○ ?? Revise
│ ○ ? Cancel
└
特殊字符
請注意,某些 shell 會處理某些字符,如 ? 或 * 或看起來像文件路徑的特殊字符。如果遇到奇怪的行為,可以將提示用引號括起來以避免出現(xiàn)問題,如下所示:
ai 'what is my ip address'
靜音模式(跳過解釋)
可以使用標(biāo)志 -s 或 --silent 禁用和跳過解釋部分
ai -s list all log files
或使用此命令將選項保存為首選項:
ai-shell config set SILENT_MODE=true
評論
圖片
表情
