Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/CrunchyData/bridge-cli

CLI for Crunchy Bridge
https://github.com/CrunchyData/bridge-cli

Last synced: about 2 months ago
JSON representation

CLI for Crunchy Bridge

Awesome Lists containing this project

README

        

# cb

A CLI for Crunchy Bridge with very good tab completion.

![cb tab animation](https://user-images.githubusercontent.com/1973/124816125-0112ff80-df1d-11eb-944c-986e6b628e92.gif)

## Installation

- For homebrew (on [macOS](https://brew.sh) or [linux](https://docs.brew.sh/Homebrew-on-Linux))
`brew install CrunchyData/brew/cb`. This will install both `cb` and the fish shell tab
completions for you.
- For others, download the [latest release](https://github.com/CrunchyData/bridge-cli/releases),
put it somewhere in your path, and be sure to manually install shell tab
completions from the `completions` directory.

## Getting started

First login to your Crunchy Bridge account by running `cb login`.

```
$ cb login
Press any key to open a browser to login or q to exit:
Waiting for login... done
Logged in as [email protected]
```

If you'd prefer to use an API key then you can create one for your
[account](https://crunchybridge.com/account/api-keys) and set the `CB_API_KEY`
environment variable.

**Note:** If the `CB_API_KEY` environment variable is set, then `cb login` will
not work until it is unset.

## Usage

Once you are logged in, you can run `cb list` to see all of your clusters, and
`cb psql ` to securely connect to your database or `cb scope` to
run health checks against it. There are many more commands that you can use to
manage things such as log destinations, firewall rules, and more.

To see what commands are available run `cb --help`, and to see more detailed
information for a given command add `--help` to it, for example `cb create
--help`.

If you use the [fish command line shell](https://fishshell.com) and have the
completions installed for you (either automatically through homebrew or
otherwise), nearly all arguments can be intelligently completed for you. This
includes all cluster IDs available to just your account, in addition to normal
subcommands and flags. Also where possible the current arguments you've given
are taken into consideration. For example if you're creating a new cluster on
AWS, instances sizes on Azure or regions in GCP will not be shown.

## Development

Install dependencies: [crystal](https://crystal-lang.org/install/)

You can run quick checks by executing `src/cli.cr` directly. While this can be
handy, it is slow because the executable is being built each time, then
executed. To build a development version run `make` or `shards build`. The
binary will be at `bin/cb` by default. There is a helper script
`dev_setup.fish` which puts the local bin directory in your path so the `cb` in
that directory will be ran, as well as an `scb` alias for running `src/cli.cr`.
It will also set up completions for each.

`crystal tool --format` will format the code as required. It is useful to have
your editor run this for you on save.

### testing

You can run `crystal spec` to run all of the specs, or `make test` to also run linting checks.

### nix

If you install nix, the included flake devShell will automatically have all
dependencies, and you can simply run `check` to run all specs and linting.

## Contributing

1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Include an entry in the changelog
6. Create a new Pull Request