https://github.com/inkel/consul-catalog
Queries Consul catalog and print out registered nodes and services. Useful for tab completion.
https://github.com/inkel/consul-catalog
cli completion consul consul-catalog devops devops-tools go golang golang-application
Last synced: 10 months ago
JSON representation
Queries Consul catalog and print out registered nodes and services. Useful for tab completion.
- Host: GitHub
- URL: https://github.com/inkel/consul-catalog
- Owner: inkel
- License: mit
- Created: 2017-09-11T17:01:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-11T18:38:48.000Z (over 8 years ago)
- Last Synced: 2025-05-15T06:39:55.025Z (11 months ago)
- Topics: cli, completion, consul, consul-catalog, devops, devops-tools, go, golang, golang-application
- Language: Go
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# consul-catalog
Queries [Consul](https://consul.io/) catalog and prints out registered nodes and services.
## Usage
Install the latest version:
```
go install -u github.com/inkel/consul-catalog
```
By default it will print the nodes and services registered. You can control whether to include nodes or services with the following flags:
```
$ ./consul-catalog -h
Usage of ./consul-catalog:
-nodes
Include node names in output (default true)
-services
Include services in output (default true)
```
This is useful for TAB completion on the CLI. For instance, in Bash, to add TAB completion to your `ssh` command, you could do something like this:
```bash
_consul_catalog() {
COMPRELY=( $( compgen -W "$(consul-catalog -services=false)" -- "$(_get_cword)" ) )
}
complete -F _consul_catalog ssh
```
Note we are using the `-services=false` flag to exclude services from being printed.
## License
See [LICENSE](LICENSE).