diff --git a/README.md b/README.md
index 557c7fc..851bebe 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,8 @@
A CLI to easily list, search and connect to SSH hosts. Sync down hosts from providers in order to get a centralized hosts configuration.
+
+
## Install
Add Homebrew Beliven tap with:
@@ -28,6 +30,8 @@ Then install `hssh` CLI with:
brew install hssh
```
+
+
## Configuration
Run `hssh init` to generate config file inside `~/.config/hssh/config.yml` (works only if not exists yet) or let the CLI creating it automatically on first run (every command).
@@ -37,6 +41,8 @@ Right now the CLI supports the following providers:
- GitLab
- GitHub
+
+
### Providers
Provide at least one connection string to a provider to start using the CLI. You can use more providers at the same time. Replace values as reported below.
@@ -51,10 +57,35 @@ Provide at least one connection string to a provider to start using the CLI. You
- **ENTITY_ID** is the reference to the project/repository where the files are stored. For GitLab is the project ID, you can find it under the project name (eg. `7192789`). For GitHub is the name of the repository (eg. `beliven-it/hssh`).
- **SUBPATH** is the path to the folder inside the project/repository where config files are saved. This parameter is optional, if you want to store hosts files inside the root of the project/repository, you can delete the `@` and everything after it in the connection string.
+You can also provide a structured version of the provider configuration in the following format:
+
+```yml
+providers:
+ - type: gitlab
+ url: "https://gitlab.com/api/v4"
+ access_token: gpat-123456789
+ entity_id: 9999
+ subpath: "path/to/folder"
+ - type: gitlab
+ url: "https://git.my-domain.com/api/v4"
+ access_token: mydingpat-123444444
+ entity_id: 11
+ subpath: "path"
+
+```
+
+> **NOTE**
+>
+> You cannot have the two providers configuration in different format. Make sure to use or the structured version, or the string version.
+
+
+
### fzf options
See the man page (`man fzf`) for the full list of available options and add the desired ones to the `fzf_options` string inside `~/.config/hssh/config.yml`. See more about the fzf options in the [official repository](https://github.com/junegunn/fzf#options).
+
+
### Config file example
This is a complete config file example with two providers:
@@ -96,10 +127,14 @@ SSH host example to put inside hosts files:
IdentityFile ~/ssh/id_rsa
```
+
+
## Usage
To see available commands and options, run: `hssh`, `hssh help`, `hssh --help` or `hssh -h`.
+
+
## Development
Clone the repository and run inside the folder:
@@ -110,14 +145,19 @@ Clone the repository and run inside the folder:
Run `./hssh` inside the folder to test the CLI.
+
+
## Have found a bug?
Please open a new issue [here](https://github.com/beliven-it/hssh/issues).
+
## Mentions
- [dmitri13](https://www.flaticon.com/authors/dmitri13) for the icon of the terminal used in the banner image
+
+
## License
Licensed under [MIT](./LICENSE)
diff --git a/providers/provider.go b/providers/provider.go
index 5a81ace..cea80d9 100644
--- a/providers/provider.go
+++ b/providers/provider.go
@@ -23,7 +23,7 @@ type IProvider interface {
type ProviderConnection struct {
Type string `mapstructure:"type"`
URL string `mapstructure:"url"`
- Token string `mapstructure:"token"`
+ Token string `mapstructure:"access_token"`
EntityID string `mapstructure:"entity_id"`
Subpath string `mapstructure:"subpath"`
}
diff --git a/templates/config.go b/templates/config.go
index 1495deb..0fc9c30 100644
--- a/templates/config.go
+++ b/templates/config.go
@@ -10,12 +10,12 @@ fzf_options: "-i"
providers:
- type: gitlab
url: "https://gitlab.com/api/v4"
- token: ""
+ access_token: ""
entity_id: ""
subpath: ""
- type: github
url: "https://api.github.com"
- token: ""
+ access_token: ""
entity_id: ""
subpath: ""
`