Skip to content

Commit 4e6433d

Browse files
committed
Add README
1 parent 25a804a commit 4e6433d

File tree

8 files changed

+74
-4
lines changed

8 files changed

+74
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
ottodocs
2+
bin/**
3+
*.zip
4+
*.tar.gz

.gptignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
LICENSE
33
go.mod
44
go.sum
5+
docs/**

Justfile

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ default:
22
just --list --unsorted
33

44
build:
5-
go build -v -o otto
5+
go build -v -o bin/otto
66

77
clean:
88
rm -f otto
@@ -12,3 +12,43 @@ run *commands:
1212

1313
cobra-docs:
1414
go run docs/gen_docs.go
15+
16+
install: build
17+
cp bin/otto $GOPATH/bin
18+
19+
crossbuild:
20+
#!/bin/bash
21+
22+
# Set the name of the output binary and Go package
23+
BINARY_NAME="otto"
24+
GO_PACKAGE="github.com/chand1012/ottodocs"
25+
26+
# Build for M1 Mac (Apple Silicon)
27+
echo "Building for M1 Mac (Apple Silicon)"
28+
env GOOS=darwin GOARCH=arm64 go build -o "${BINARY_NAME}" "${GO_PACKAGE}"
29+
zip "${BINARY_NAME}_darwin_arm64.zip" "${BINARY_NAME}"
30+
rm "${BINARY_NAME}"
31+
32+
# Build for AMD64 Mac (Intel)
33+
echo "Building for AMD64 Mac (Intel)"
34+
env GOOS=darwin GOARCH=amd64 go build -o "${BINARY_NAME}" "${GO_PACKAGE}"
35+
zip "${BINARY_NAME}_darwin_amd64.zip" "${BINARY_NAME}"
36+
rm "${BINARY_NAME}"
37+
38+
# Build for AMD64 Windows
39+
echo "Building for AMD64 Windows"
40+
env GOOS=windows GOARCH=amd64 go build -o "${BINARY_NAME}.exe" "${GO_PACKAGE}"
41+
zip "${BINARY_NAME}_windows_amd64.zip" "${BINARY_NAME}.exe"
42+
rm "${BINARY_NAME}.exe"
43+
44+
# Build for AMD64 Linux
45+
echo "Building for AMD64 Linux"
46+
env GOOS=linux GOARCH=amd64 go build -o "${BINARY_NAME}" "${GO_PACKAGE}"
47+
tar czvf "${BINARY_NAME}_linux_amd64.tar.gz" "${BINARY_NAME}"
48+
rm "${BINARY_NAME}"
49+
50+
# Build for ARM64 Linux
51+
echo "Building for ARM64 Linux"
52+
env GOOS=linux GOARCH=arm64 go build -o "${BINARY_NAME}" "${GO_PACKAGE}"
53+
tar czvf "${BINARY_NAME}_linux_arm64.tar.gz" "${BINARY_NAME}"
54+
rm "${BINARY_NAME}"

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ottodocs
2+
3+
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
4+
5+
`ottodocs` is a command-line tool written in Go that uses GPT-3 to automatically generate or add inline documentation for your code. It can parse a git repository or an individual file and create markdown documentation or add inline comments. The tool requires an OpenAI API key to function.
6+
7+
`ottodocs` utilizes the `just` command runner for building and running tasks, making it easy to use and maintain.
8+
9+
## Installation
10+
11+
There are two methods to install `ottodocs` :
12+
13+
1. **Precompiled binaries:** Download the precompiled binaries from the [GitHub releases tab](https://github.com/chand1012/ottodocs/releases).
14+
2. **Build from source:** Clone the repo and build the binary by running the following commands:
15+
16+
```sh
17+
git clone https://github.com/chand1012/ottodocs.git
18+
cd ottodocs
19+
just build # will output binary to bin/otto. Copy the file to a directory in your PATH
20+
```
21+
22+
## Usage
23+
24+
For detailed usage instructions, please refer to the [documentation](docs/otto.md).

cmd/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
2+
Copyright © 2023 Chandler <chandler@chand1012.dev>
33
*/
44
package cmd
55

cmd/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
2+
Copyright © 2023 Chandler <chandler@chand1012.dev>
33
*/
44
package cmd
55

cmd/prompt.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os"
99

1010
"github.com/chand1012/git2gpt/prompt"
11+
"github.com/pandodao/tokenizer-go"
1112
"github.com/spf13/cobra"
1213
)
1314

@@ -72,7 +73,7 @@ var promptCmd = &cobra.Command{
7273
fmt.Println(output)
7374
}
7475
if estimateTokens {
75-
fmt.Printf("Estimated number of tokens: %d\n", prompt.EstimateTokens(output))
76+
fmt.Printf("Estimated number of tokens: %d\n", tokenizer.MustCalToken(output))
7677
}
7778
},
7879
}

docs/.gptignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gen_docs.go

0 commit comments

Comments
 (0)