|
| 1 | +# Hostinger API Command Line Interface |
| 2 | + |
| 3 | +A powerful command-line interface for managing Hostinger services through the Hostinger API. |
| 4 | + |
| 5 | +For more information, please visit https://developers.hostinger.com. |
| 6 | + |
| 7 | +# Installation |
| 8 | + |
| 9 | +## Downloading a Release from GitHub |
| 10 | +Download the latest binary from the [releases page](https://github.com/hostinger/api-cli/releases). |
| 11 | + |
| 12 | +### Linux |
| 13 | + |
| 14 | +Download, extract and move the binary: |
| 15 | +```bash |
| 16 | +cd ~ |
| 17 | +wget https://github.com/hostinger/api-cli/releases/download/<version>/hapi-<version>-linux-<arch>.tar.gz |
| 18 | +tar xf ~/hapi-<version>-linux-<arch>.tar.gz |
| 19 | +mv hapi /usr/local/bin |
| 20 | +``` |
| 21 | + |
| 22 | +### macOS |
| 23 | +WIP |
| 24 | + |
| 25 | +### Windows |
| 26 | +WIP |
| 27 | + |
| 28 | +# Configuration |
| 29 | + |
| 30 | +## File |
| 31 | +Full example and possible values of the configuration file [can be found here](https://github.com/hostinger/api-cli/blob/main/hapi.yaml) |
| 32 | + |
| 33 | +By default, configuration file will be read from `$HOME/.hapi.yaml`. |
| 34 | + |
| 35 | +You can always define which configuration file to use by using `--config` argument, eg.: |
| 36 | +```bash |
| 37 | +hapi --config path/to/your/config.yaml ... |
| 38 | +``` |
| 39 | + |
| 40 | +## Environment variables |
| 41 | +Instead of providing configuration file, you can provide configuration using environment variables. |
| 42 | +Each config file property must have `HAPI_` prefix and key name in ALL CAPS, for example to provide |
| 43 | +`api_token` parameter, you would export variable like this: |
| 44 | + |
| 45 | +```bash |
| 46 | +export HAPI_API_TOKEN=<your token> |
| 47 | +hapi vps vm list |
| 48 | +``` |
| 49 | + |
| 50 | +# Usage |
| 51 | + |
| 52 | +See the [full reference documentation](blob/main/docs/hapi.md) for information about each available command. |
| 53 | + |
| 54 | +# Enabling shell auto-completion (optional) |
| 55 | + |
| 56 | +`hapi` has auto-complete support. This makes it easier to use the CLI and improves user experience by completing command |
| 57 | +names by clicking TAB key. For example if you type `hapi vps dat<TAB>` with auto-completion enabled, shell will automatically append |
| 58 | +rest of the command: `hapi vps data-centers`. |
| 59 | + |
| 60 | +Auto-completion can be generated for multiple shells. The currently supported shells are: |
| 61 | +- Bash |
| 62 | +- Zsh |
| 63 | +- fish |
| 64 | +- PowerShell |
| 65 | + |
| 66 | +After adding shell auto-completion, remember to refresh your shell profile by logging out from the shell and log back in. |
| 67 | + |
| 68 | +Read more on [how to enable auto-completion](blob/main/AUTOCOMPLETE.md). |
0 commit comments