{"id":19141303,"url":"https://github.com/ans-group/cli","last_synced_at":"2026-03-06T14:31:36.970Z","repository":{"id":37847588,"uuid":"173141462","full_name":"ans-group/cli","owner":"ans-group","description":"Command line utility for accessing ANS services/APIs","archived":false,"fork":false,"pushed_at":"2025-04-17T13:13:57.000Z","size":3683,"stargazers_count":11,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T03:20:34.436Z","etag":null,"topics":["cli","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ans-group.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-28T15:54:23.000Z","updated_at":"2025-04-17T13:13:12.000Z","dependencies_parsed_at":"2024-02-13T12:52:28.179Z","dependency_job_id":"ce87efd5-fae5-4e67-9303-7c67a276f5a2","html_url":"https://github.com/ans-group/cli","commit_stats":{"total_commits":298,"total_committers":12,"mean_commits":"24.833333333333332","dds":0.5167785234899329,"last_synced_commit":"d1f5ca89b6457db8ddc4c022d3ea3b889411ba23"},"previous_names":["ukfast/cli"],"tags_count":95,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ans-group%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ans-group%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ans-group%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ans-group%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ans-group","download_url":"https://codeload.github.com/ans-group/cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252788376,"owners_count":21804280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","hacktoberfest"],"created_at":"2024-11-09T07:22:35.943Z","updated_at":"2025-10-20T07:37:07.751Z","avatar_url":"https://github.com/ans-group.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ANS CLI\n\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nThis is the official ANS command-line client, allowing for querying and controlling\nsupported ANS services.\n\nThe client utilises ANS APIs to provide access to most service features. You should refer to the \n[Getting Started](https://developers.ukfast.io/getting-started) section of the API documentation before \nproceeding below.\n\n## Demo\n\n### SafeDNS\n\n![](docs/demo/safedns-example.gif)\n\n### eCloud VPC\n\n![](docs/demo/ecloud-example.gif)\n\n## Installation\n\nThe CLI is distributed as a single binary, and is available for Windows, Linux and Mac. This binary \nshould be downloaded and placed into a directory included in your `PATH`. This would typically \nbe `/usr/local/bin` on most Linux distributions\n\nPre-compiled binaries are available at [Releases](https://github.com/ans-group/cli/releases)\n\n### Building from source\n\nInstall the dependencies, golang and make, then build from the Makefile.\n\n```\n# make\n```\n\nTo copy to /usr/local/bin, as root or using sudo\n\n```\n# make install\n```\n\n## Getting started\n\nTo get started, we will define a single environment variable to store our API key:\n\nBash:\n\u003e export ANS_API_KEY=\"iqmxgom0kairfnxzcopte5hx\"\n\nPowerShell:\n\u003e $env:ANS_API_KEY=\"iqmxgom0kairfnxzcopte5hx\"\n\nAnd away we go!\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874\n+---------+--------------------+------+---------+---------------------------+----------+-----+\n|   ID    |        NAME        | TYPE | CONTENT |        UPDATED AT         | PRIORITY | TTL |\n+---------+--------------------+------+---------+---------------------------+----------+-----+\n| 3337874 | test.example.co.uk | A    | 1.2.3.4 | 2019-03-19T16:33:55+00:00 |        0 |   0 |\n+---------+--------------------+------+---------+---------------------------+----------+-----+\n```\n\n## Configuration\n\nThe CLI utilises the common config from the underlying SDK, with details available [here](https://github.com/ans-group/sdk-go#config).\n\n### Schema\n\nThe CLI adds the following to the config schema:\n\n* `api_debug`: (bool) Specifies for debug messages to be output to stderr\n* `api_pagination_perpage` (int) Specifies the per-page for paginated requests\n\n### Contexts\n\nContexts can be defined in the config file to allow for different sets of configuration to be defined. The current context can be overridden with the `--context` flag\n\n### Commands\n\nThe configuration file can be manipulated using the `config` subcommand, for example:\n\n```\n\u003e ans config context update --current --api-key test1\n\u003e ans config context update someothercontext --api-key test1\n\u003e ans config context switch someothercontext\n```\n\n## Output Formatting\n\nThe output of all commands is determined by a single global flag `--output` / `-o`.\nIn addition to output, there are several output modifier flags which are explained below.\n\nThe default output format can be set in the configuration file using the `output.default` field, e.g.\n\n```yaml\noutput:\n  default: json\n```\n\n### Table (Default)\n\nThe default output format for the CLI is `Table`, which will be used when the value of the `--output` flag\nis `table` or unspecified:\n\n```\n\u003e ans safedns zone record list example.co.uk\n+---------+--------------------+------+-----------------------------------------------------------------------+---------------------------+----------+-------+\n|   ID    |        NAME        | TYPE |                                CONTENT                                |        UPDATED AT         | PRIORITY |  TTL  |\n+---------+--------------------+------+-----------------------------------------------------------------------+---------------------------+----------+-------+\n| 3337865 | ns0.ans.uk         | NS   | 185.226.220.128                                                       | 2019-03-19T16:31:48+00:00 |        0 |     0 |\n| 3337868 | ns1.ans.uk         | NS   | 185.226.221.128                                                       | 2019-03-19T16:31:48+00:00 |        0 |     0 |\n| 3337871 | example.co.uk      | SOA  | ns0.ans.uk support.ans.co.uk 2019031901 7200 3600 604800 86400        | 2019-03-19T16:31:48+00:00 |        0 | 86400 |\n| 3337874 | test.example.co.uk | A    | 1.2.3.4                                                               | 2019-03-19T16:33:55+00:00 |        0 |     0 |\n+---------+--------------------+------+-----------------------------------------------------------------------+---------------------------+----------+-------+\n```\n\nThe [Property Modifier](#property) is available for this format\n\nThe table output style can be customised using the `output.table.style` field in your configuration file. This directive accepts either `ascii` (default) or `unicode`, which will change the table output to use unicode characters for borders and lines.\n\n```yaml\noutput:\n  table:\n    style: unicode\n```\n\n### List\n\nResults can be output as a list using the `list` format:\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output list\nid         : 3337874\nname       : test.example.co.uk\ntype       : A\ncontent    : 1.2.3.4\nupdated_at : 2019-03-19T16:33:55+00:00\npriority   : 0\nttl        : 0\n```\n\nThe [Property Modifier](#property) is available for this format\n\n### JSON\n\nResults can be output in JSON using the `json` format:\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output json\n[{\"id\":3337874,\"template_id\":0,\"name\":\"test.example.co.uk\",\"type\":\"A\",\"content\":\"1.2.3.4\",\"updated_at\":\"2019-03-19T16:33:55+00:00\",\"ttl\":0,\"priority\":0}]\n```\n\nYou can also the use the `json-pretty` format to output pretty-printed JSON:\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output json-pretty\n[\n  {\n    \"id\": 3337874,\n    \"template_id\": 0,\n    \"name\": \"test.example.co.uk\",\n    \"type\": \"A\",\n    \"content\": \"1.2.3.4\",\n    \"updated_at\": \"2019-03-19T16:33:55+00:00\",\n    \"ttl\": 0,\n    \"priority\": 0\n  }\n]\n```\n\n### YAML\n\nResults can be output in YAML using the `yaml` format:\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output yaml\n- id: 3337874\n  templateid: 0\n  name: test.example.co.uk\n  type: A\n  content: 1.2.3.4\n  updatedat: \"2019-03-19T16:33:55+00:00\"\n  ttl: 0\n  priority: 0\n```\n\n### Value\n\nResults can be output with a value or set of values using the `value` format:\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output value\n3337874 test.example.co.uk A 1.2.3.4 2019-03-19T16:33:55+00:00 0 0\n```\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output value --property id\n3337874\n```\n\nThe [Property Modifier](#property) is available for this format\n\n### CSV\n\nResults can be output as CSV using the `csv` format:\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output csv\nid,name,type,content,updated_at,priority,ttl\n3337874,test.example.co.uk,A,1.2.3.4,2019-03-19T16:33:55+00:00,0,0\n```\n\nThe [Property Modifier](#property) is available for this format\n\n### Template\n\nResults can be output using a supplied Golang template string using the `template` format\nin conjunction with output arguments, e.g.\n\n```\n\u003e ans safedns zone record list example.co.uk --output template=\"Record name: {{ .Name }}, Type: {{ .Type }}\"\nRecord name: ns0.ans.uk, Type: NS\nRecord name: ns1.ans.uk, Type: NS\nRecord name: example.co.uk, Type: SOA\nRecord name: test.example.co.uk, Type: A\n```\n\n### JSON path\n\nResults can be output via JSON Path using the `jsonpath` format\nin conjunction with output arguments, e.g.\n\n```\n\u003e ans safedns zone record list example.co.uk --output jsonpath=\"{[*].name}\"\nexample.co.uk example.co.uk example.co.uk test.example.co.uk\n```\n\n\n## Output modifiers\n\n### Property\n\nSome output formats support the `--property` output modifier.\n\nRequired properties can be specified with the `--property` format modifer flag:\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output value --property name\ntest.example.co.uk\n```\n\nThe property modifier accepts a comma-delimited list of property names, and is also repeatable:\n\n```\n\u003e ans safedns zone record show example.co.uk 3337874 --output value --property id,name --property content\n3337874 test.example.co.uk 1.2.3.4\n```\n\nThe property modifier also accepts globbing e.g. `*`, `some*`, `*thing`\n\n\n## Filtering\n\nWhen using `list` commands, filtering is available via the `--filter` flag. Additionally, optional operators are available.\n\n### Examples\n\n```\n--filter id=123\n--filter id:lt=10\n```\n\nAdditionally, the `lk` filter is inferred when a glob `*` is included in the filter value (when operator is omitted)\n\n\n## Sorting\n\nWhen using `list` commands, sorting is available via the `--sort` flag.\n\n### Examples\n\n```\n--sort id\n--sort id:desc\n```\n\n## Updates\n\nThe CLI has self-update functionality, which can be invoked via the command `update`:\n\n```\n\u003e ans update\n```\n\nThis command in-place updates the CLI, with the old binary moved to `ans.old` (`ans.old.exe` on Windows), should roll-back be required.\n\n### Migrating from the UKFast CLI\n\nIf you are upgrading from the old `ukfast` client, you will need to install this client from scratch. You will need to rename `~/.ukfast.yml` to `~/.ans.yml` and ensure any environment variables are updated to use the new `ANS_` prefix, e.g. `UKF_ECLOUD_VPC=true` becomes `ANS_ECLOUD_VPC=true`.\n\n## Shell autocompletions\n\nThe CLI supports generating shell completions for the following shells:\n\n* Bash\n* Zsh\n* PowerShell\n\nThe commands at `ans completion \u003cshell: bash|zsh|powershell\u003e` provide help for installation on different platforms\n\n## Releasing\n\n`goreleaser` is used to release the CLI on Github. \n\nFirst, we'll obtain our GPG fingerprint:\n\n```\ngpg -k\n```\n\nNext, we'll set some environment variables - including GPG fingerprint from above:\n\n```\nexport GITHUB_TOKEN=\u003ctoken\u003e\nexport GPG_FINGERPRINT=\u003cfingerprint\u003e\nexport GPG_TTY=$(tty)\n```\n\nWe'll then need to cache our GPG passphrase:\n\n```\ngpg --armor --detach-sign -n main.go\n```\n\nFinally push a new tag and invoke `goreleaser`:\n\n```\ngit tag v1.10.0\ngit push --tags\ngoreleaser --rm-dist\n```\n\n\n## eCloud VPC resources\n\neCloud VPC resource commands are available by default under the `ecloud` subcommand.\n\nTo display only VPC commands, the following environment variable can be set:\n\n```\n\u003e export ANS_ECLOUD_VPC=true\n```\n\nTo display only original commands, the following environment variable can be set:\n\n```\n\u003e export ANS_ECLOUD=true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fans-group%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fans-group%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fans-group%2Fcli/lists"}