Skip to content

Commit

Permalink
Small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
aandrew-me committed Jun 17, 2023
1 parent 5130072 commit 256e223
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ jobs:
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o tgpt-mac-amd64
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o tgpt-mac-arm64
echo "SHA256 hashes of the built binaries:"
echo "SHA256 hashes of the built binaries:" > hashes.txt
sha256sum tgpt-linux-amd64
sha256sum tgpt-linux-amd64 >> hashes.txt
sha256sum tgpt-linux-i386
sha256sum tgpt-linux-i386 >> hashes.txt
sha256sum tgpt-linux-arm64
sha256sum tgpt-linux-arm64 >> hashes.txt
sha256sum tgpt-amd64.exe
sha256sum tgpt-amd64.exe >> hashes.txt
sha256sum tgpt-i386.exe
sha256sum tgpt-i386.exe >> hashes.txt
sha256sum tgpt-mac-amd64
sha256sum tgpt-mac-amd64 >> hashes.txt
sha256sum tgpt-mac-arm64
sha256sum tgpt-mac-arm64 >> hashes.txt
- name: Upload Artifacts
id: upload-artifacts
uses: softprops/action-gh-release@v1
Expand All @@ -48,6 +72,7 @@ jobs:
tgpt-i386.exe
tgpt-mac-amd64
tgpt-mac-arm64
hashes.txt
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
tag_name: v
Expand Down
9 changes: 4 additions & 5 deletions functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func getData(input string, chatId string, configDir string, isInteractive bool)
os.Exit(0)
}

mainText := fmt.Sprintf("%s", jsonObj["text"])
mainText := fmt.Sprintf("%s", jsonObj["delta"])

if !gotId {
if jsonObj == nil {
Expand Down Expand Up @@ -179,17 +179,16 @@ func getData(input string, chatId string, configDir string, isInteractive bool)
}
} else {
newLine = mainText
result := strings.Replace(newLine, oldLine, "", -1)
wordLength := len(result)
wordLength := len(mainText)

if termWidth-lineLength < wordLength {
fmt.Print("\n")
lineLength = 0
}
lineLength += wordLength
splitLine := strings.Split(result, "")
splitLine := strings.Split(mainText, "")

if result == "``" || result == "```" {
if mainText == "``" || mainText == "```" {
isRealCode = true
} else {
isRealCode = false
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/olekukonko/ts"
)

const localVersion = "1.6.8"
const localVersion = "1.6.9"

var bold = color.New(color.Bold)
var boldBlue = color.New(color.Bold, color.FgBlue)
Expand Down Expand Up @@ -183,7 +183,9 @@ func main() {
}

boldBlue.Println("\nExamples:")
fmt.Println(`tgpt "What is internet?"`)
fmt.Println("tgpt -f")
fmt.Println(`tgpt -m`)
fmt.Println(`tgpt -s "How to update my system?"`)
} else {
go loading(&stopSpin)
Expand Down

0 comments on commit 256e223

Please sign in to comment.