Skip to content
/ dotsh Public

a cli tool for generating bash scripts with GPT 4

Notifications You must be signed in to change notification settings

ededejr/dotsh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotsh

A CLI tool for generating and running bash scripts using gpt-4.

Designed and implemented using ChatGPT, inspired by this Twitter thread.

➜  ~ dotsh
A CLI tool for generating and running executable scripts based on OpenAI chat completion

Usage:
  dotsh [command]

Available Commands:
  configure   Configure API key for OpenAI
  help        Help about any command
  list        List all scripts in the script directory
  make        Generate an executable script based on OpenAI chat completion
  read        Display the contents of a script
  remove      Remove an existing script
  reset       Remove all scripts and the API key
  run         Execute a script generated by 'dotsh make'

Flags:
  -h, --help   help for dotsh

Use "dotsh [command] --help" for more information about a command.

Usage

Generate a script to check the weather.

➜  ~ dotsh make check-weather "checks the weather for a city given as an argument using wttr.in"
Generated script 'check-weather.sh'

You can now view the script that was generated.

➜  ~ dotsh read check-weather
#!/bin/bash

city=$1

if [[ -z "$city" ]]; then
    echo "Please provide a city name as an argument"
    exit 1
fi

weather=$(curl -s "wttr.in/$city?format=%C\n%t\n")

echo "Current weather in $city: $weather"

exit 0

If you're content, go ahead and run the script.

➜  ~ dotsh run check-weather mississauga
Current weather in mississauga: Rain, mist
+3°C