Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith committed Mar 19, 2023
1 parent 2a60ad5 commit 8c2b9ec
Show file tree
Hide file tree
Showing 818 changed files with 145,568 additions and 1 deletion.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
# startree-cli


This is a naive CLI implementation for StarTree using the swagger.json file from the Apache Pinot server

## Installation Instructions
To use, copy releases/startree-arm64 to /usr/local/bin and then `chmod +x /usr/local/bin/startree-arm64`
You will likely want to run `ln -s /usr/local/bin/startree-arm64 /usr/local/bin/startree` to make it easier to run

To avoid having to manually set the hostname and auth token each time, create the following directory `mkdir -p /Users/$USER/.config/startree` then copy the config from `releases/config.yaml` to that new directory

Edit the config.yaml and replace $HOSTNAME with the hostname of your cluster (something like pinot.startree.cloud, do not include https://) and replace ${TOKEN} with your API token. Note that this field is encapsulated and requires the auth type prepended, so it should look something like:
`Authorization: 'Basic OIFDGsjfe24234sdfdfsdv...='`

## Usage instructions

This "should" work identically to the swagger UI that's hosted in the cluster. All functions include any help text that was included in the original swagger.json.

If something isn't working as expected, the `--debug` flag is useful to see what is actually going on.

### Enable Shell Completion on Mac

To enable shell completion on mac, first you will need to enable Shell Completion in zsh. Run the following command once:

`echo "autoload -U compinit; compinit" >> ~/.zshrc`

After that, you can run the following command to enable shell completion for the current session.

`source <(startree completion zsh)`

If you would like to add this permanently to the system, you can do the following:
```
mkdir -p ${fpath[1]}
chown $USER ${fpath[1]}
sudo startree completion zsh > "${fpath[1]}/_startree"
```

## Building / Development

This CLI was built using the swagger build tools from https://goswagger.io/generate/cli.html

To install swagger, you can download the appropriate binary from https://github.com/go-swagger/go-swagger/releases/ and copy it to `/usr/local/bin`

Make sure your clone of this repo is in your $GOPATH, `cd src`, and then run the following commands:
```
go mod tidy
swagger generate cli -f swagger.json --cli-app-name startree
go build -o cmd/startree/main.go
```

2 changes: 2 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Authorization: 'Basic ${TOKEN}'
hostname: $HOSTNAME
1 change: 1 addition & 0 deletions releases/startree
Binary file added releases/startree-arm64
Binary file not shown.
179 changes: 179 additions & 0 deletions src/cli/add_config_operation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8c2b9ec

Please sign in to comment.