Skip to content

Commit

Permalink
Add release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrugman committed Jan 12, 2025
1 parent 03d2dd7 commit d4ebf13
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ builds:
- 6
- 7
archives:
- format: tar.gz
- format: binary
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
release:
name_template: "v{{ .Version }}"
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,16 @@ OUTPUT_DIR=$(CURDIR)/dist

BINARY_NAME=qory

build:
goreleaser build --snapshot --clean --single-target --output $(OUTPUT_DIR)/$(BINARY_NAME)
build: format
goreleaser build \
--snapshot \
--clean \
--single-target \
--output $(OUTPUT_DIR)/$(BINARY_NAME)

release: format
goreleaser release \
--clean

format:
go fmt ./...
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,41 @@ Add output from a shell command:
qory "This is my project dir" "$(ls)" "How should I improve it?"
```

## Install

Qory is compiled for all major operating systems and architectures.
If you are looking for an architecture that is not supported, please open a ticket.

There are three install options:

### 1. Manual

Go to the 'releases' tab, and download the right asset for your system.
On Unix systems, set it as an executable using `chmod +x <file>`, and just run it.

### 2. Unix

Download and install into a directory of your choosing using a one-liner.

Download into your system's bin directory, i.e. `/usr/local/bin` (requires `sudo`):
```
curl -L -o ./qory https://github.com/dtrugman/qory/releases/download/v0.1/qory_0.1_darwin_arm64 && chmod +x ./qory && sudo mv ./qory /usr/local/bin/.
```
If you prefer `wget`:
```
wget -O ./qory https://github.com/dtrugman/qory/releases/download/v0.1/qory_0.1_darwin_arm64 && chmod +x ./qory && sudo mv ./qory /usr/local/bin/.
```
Now you should be able to run `qory`.

If you are an advanced user, feel free to install it into **any other dir in your PATH**:
```
curl -L -o ./qory https://github.com/dtrugman/qory/releases/download/v0.1/qory_0.1_darwin_arm64 && chmod +x ./qory && mv ./qory ~/.local/bin/.
```

## Check installation

Run `qory --version` and see if the command succeeds.

## Configuration

To start using Qory, you need to set two values, your API key and the model you want to use.
Expand Down
15 changes: 13 additions & 2 deletions cmd/qory/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import (
const (
appName = "Qory"

argConfig = "--config"
argConfig = "--config"
argVersion = "--version"

argAPIKey = "api-key"
argBaseURL = "base-url"
Expand All @@ -26,13 +27,16 @@ const (
)

var (
version = "dev"

ErrorBadArguments = errors.New("bad arguments")
)

func usage(arg0 string) {
fmt.Printf("%s: A language model in your terminal\n", appName)
fmt.Printf("\n")
fmt.Printf("Usage: %s [input]...\n", arg0)
fmt.Printf(" %s --version\n", arg0)
fmt.Printf(" %s --config [options]\n", arg0)
fmt.Printf("\n")
fmt.Printf("%s is a tool for accessing language models directly from your CLI\n", appName)
Expand Down Expand Up @@ -195,6 +199,11 @@ func runConfigKey(
return ErrorBadArguments
}

func runVersion() error {
fmt.Printf("%s version %s\n", appName, version)
return nil
}

func runConfig(args []string, conf config.Config) error {
if len(args) < 3 {
usageConfig(args[0])
Expand Down Expand Up @@ -236,7 +245,9 @@ func run(args []string) error {
return err
}

if action == argConfig {
if action == argVersion {
return runVersion()
} else if action == argConfig {
return runConfig(args, conf)
} else { // no action, an implicit query
return runQuery(args, conf)
Expand Down

0 comments on commit d4ebf13

Please sign in to comment.