anexia-cli

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 3 Imported by: 0

README

anexia-cli

CI Coverage Release Go Reference

A small command-line interface for the Anexia Engine API, built on the official go-anxcloud client. It currently covers listing vSphere provisioning locations and managing local configuration.

The project is anexia-cli; the installed command is anexia.

Install

Homebrew
brew install --cask ProbstenHias/tap/anexia

The cask lives in ProbstenHias/homebrew-tap and is regenerated on every release. The binary is not signed or notarized, so the cask strips the macOS quarantine attribute at install time.

Prebuilt archives

Archives for darwin, linux and windows (amd64 and arm64) are attached to each GitHub release. Unpack one and put anexia somewhere on your PATH.

From source
git clone https://github.com/ProbstenHias/anexia-cli.git
cd anexia-cli
make build   # ./bin/anexia

go install is deliberately not supported: it names the binary after the module, giving you anexia-cli instead of anexia.

Quickstart

anexia config set token <token>
anexia location list

Usage

anexia location list

Lists vSphere provisioning locations.

Flag Default Description
--page 1 Page number to fetch. Must be 1 or greater.
--limit 50 Locations per page. Must be between 1 and 1000.
--location-code Filter by location code.
--organization Filter by organization.
$ anexia location list --limit 3
CODE    NAME                      COUNTRY       ID
ANX04   AT, Vienna, Datasix       Austria       52b5f6b2fd3a4a24b41c4d8f8f7a5e01
ANX21   DE, Frankfurt, Equinix    Germany       f6f2d1c4f0f14e2b9a3c7d5e2b1a4c33
ANX63   CH, Zurich, Interxion     Switzerland   3c9a7b1e5d4f42a08e6b2c1d9f8a7b65

If no locations match, the table header is still printed and no locations found goes to stderr.

JSON output returns the raw location objects from the API:

anexia location list -o json --location-code ANX04
[
  {
    "code": "ANX04",
    "country": "AT",
    "id": "52b5f6b2fd3a4a24b41c4d8f8f7a5e01",
    "lat": "48.208174",
    "lon": "16.373819",
    "name": "AT, Vienna, Datasix",
    "country_name": "Austria"
  }
]

The COUNTRY column shows country_name when the API returns it, and falls back to the two-letter country code otherwise.

Global flags
Flag Default Description
--config Path to the config file.
--token Anexia API token.
--api-base-url Anexia Engine base URL. Empty means the go-anxcloud default.
--output, -o table Output format: table or json.
--timeout 30s Timeout for API requests.

Configuration

Values are layered, lowest precedence first:

Precedence Source Details
1 (lowest) Config file token, api_base_url
2 Environment ANEXIA_TOKEN -> token, ANEXIA_API_BASE_URL -> api_base_url
3 (highest) Command-line flags --token, --api-base-url, only when explicitly set

Flags only participate when you actually pass them, so unset flag defaults never overwrite a value from the file or the environment. Empty environment variables are ignored too.

The config file path is resolved in this order:

  1. --config
  2. $ANEXIA_CONFIG
  3. $XDG_CONFIG_HOME/anexia/config.yaml
  4. ~/.config/anexia/config.yaml

A missing file is not an error. When anexia writes the file it creates the parent directory with mode 0700 and the file with mode 0600, replacing it atomically. The only valid keys are token and api_base_url; anything else makes reading the file fail rather than being silently ignored.

token: your-anexia-api-token
api_base_url: https://engine.anexia-it.com
Config subcommands
Command Description
anexia config path Print the resolved config file path.
anexia config init [--force] Write an empty config file. Fails if one exists unless --force.
anexia config set <key> <value> Set token or api_base_url and save.
anexia config get <key> Print one value from the config file.
anexia config view Print the whole stored config, as a table or with -o json.

The token is masked in both config get token and config view: all but the last four characters are replaced with *. get and view read the config file only, they do not layer in the environment or flags.

Development

make build   # build ./bin/anexia with version info linked in
make test    # go test -race ./...
make lint    # golangci-lint
make fmt     # gofumpt -w .
make ci      # fmt-check, vet, lint, test

Tests exercise the real command tree against net/http/httptest servers instead of mocking the API client.

Releasing

Releases are cut by release-please. Pull requests are squash merged and the pull request title becomes the commit subject on main, so titles must follow Conventional Commits; a CI check enforces this. feat: bumps the minor version, fix: the patch version.

release-please keeps a chore(release): release X.Y.Z pull request open that collects those subjects into CHANGELOG.md and bumps .release-please-manifest.json. Merging it tags the release, which triggers GoReleaser to build the archives, publish the GitHub release and update the Homebrew cask. Nothing is tagged by hand.

License

MIT, Matthias Weilinger. See LICENSE.

Documentation

Overview

Command anexia is a command-line interface for the Anexia Engine API.

Directories

Path Synopsis
internal
anx
Package anx builds go-anxcloud clients from already-resolved settings.
Package anx builds go-anxcloud clients from already-resolved settings.
cli
Package cli defines the anexia command tree.
Package cli defines the anexia command tree.
config
Package config loads, saves, and layers anexia configuration.
Package config loads, saves, and layers anexia configuration.
output
Package output renders command results as aligned tables or as JSON.
Package output renders command results as aligned tables or as JSON.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL