# circleci-env-cli
CLI tool for manage CircleCI contexts and environment vars
## Installation
### Install locally
```
pip install -r requirements.txt
./circleci_env_cli.py [OPTIONS]
```
### Install via Pip
```
pip install circleci-env-cli
```
### Install via Docker
```
docker run --rm phsmith/circleci-env-cli:latest [OPTIONS]
```
## Usage
A [CircleCI personal API token](https://circleci.com/docs/managing-api-tokens/#creating-a-personal-api-token) must be create before use this tool.
> All options can be specified as environment variables in the format: `CIRCLE_<OPTION>`.
>
> Example: `CIRCLE_TOKEN=********`
```
Usage: circleci-env-cli [OPTIONS]
CLI tool for manage CircleCI contexts and environment vars
Options:
-u, --api-url <circleci_api_url>
[default: https://circleci.com/api]
-t, --token <circleci_token> [default: (CIRCLE_TOKEN)]
-c, --context <context_name> It will ask for create if does not exists
-p, --project <project_slug> Example: github/org-name/project-name
[required]
-e, --env <environment_var>
-ef, --env-file <environment_vars_file>
-l, --list-envs
-d, --delete Context only, will delete the context
Context + vars, will delete the context vars
Vars only, will delete the environment vars
-ot, --owner-type <owner_type> [default: organization]
--debug
--help Show this message and exit.
```
### Examples
#### List project environment variables
```
$ circleci-env-cli -p github/myorg/myproject -l
>
KEY1
KEY2
```
#### Add project environment variables
```
$ circleci-env-cli -p github/myorg/myproject -e KEY1=VAL1 -e KEY2=VAL2 -ef project.envs.txt
> Successfully add/update variable: KEY1
> Successfully add/update variable: KEY2
> Successfully add/update variable: KEY3
> Successfully add/update variable: KEY4
```
#### Delete project environment variables
```
$ circleci-env-cli -p github/myorg/myproject -e KEY1 -e KEY2 -d
> Successfully delete variable: KEY1
> Successfully delete variable: KEY2
```
#### List context variables
```
$ circleci-env-cli -p github/myorg/myproject -c mycontext -l
>
KEY1
KEY2
```
#### Create/update context and add variables
```
$ circleci-env-cli -p github/myorg/myproject -c mycontext -e KEY1=VAL1 -e KEY2=VAL2
The context named "mycontext" was not found. Do you want to create it? [y/n]: y
> Successfully create context: mycontext
> Successfully add/update context variable: KEY1
> Successfully add/update context variable: KEY2
```
#### Delete context variables
```
$ circleci-env-cli -p github/myorg/myproject -c mycontext -e KEY1 -e KEY2 -d
> Successfully delete context variable: KEY1
> Successfully delete context variable: KEY2
```
#### Delete context
```
$ circleci-env-cli -p github/myorg/myproject -c mycontext -d
Are you sure want to delete the context "mycontext"? [y/n]: y
> Successfully delete context
```
Raw data
{
"_id": null,
"home_page": "https://github.com/phsmith/circleci-env-cli",
"name": "circleci-env-cli",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "circleci cli api",
"author": "Phillipe Smith",
"author_email": "phsmithcc@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f6/3f/27f83dc51a98206fa4a1ff1d8b4872b5c17eda281b72a63780b7769db9c2/circleci-env-cli-0.2.0.tar.gz",
"platform": null,
"description": "# circleci-env-cli\nCLI tool for manage CircleCI contexts and environment vars\n\n## Installation\n### Install locally\n```\npip install -r requirements.txt\n./circleci_env_cli.py [OPTIONS]\n```\n\n### Install via Pip\n```\npip install circleci-env-cli\n```\n\n### Install via Docker\n```\ndocker run --rm phsmith/circleci-env-cli:latest [OPTIONS]\n```\n\n## Usage\n\nA [CircleCI personal API token](https://circleci.com/docs/managing-api-tokens/#creating-a-personal-api-token) must be create before use this tool.\n\n> All options can be specified as environment variables in the format: `CIRCLE_<OPTION>`.\n>\n> Example: `CIRCLE_TOKEN=********`\n\n```\nUsage: circleci-env-cli [OPTIONS]\n\n CLI tool for manage CircleCI contexts and environment vars\n\nOptions:\n -u, --api-url <circleci_api_url>\n [default: https://circleci.com/api]\n -t, --token <circleci_token> [default: (CIRCLE_TOKEN)]\n -c, --context <context_name> It will ask for create if does not exists\n -p, --project <project_slug> Example: github/org-name/project-name\n [required]\n -e, --env <environment_var>\n -ef, --env-file <environment_vars_file>\n -l, --list-envs\n -d, --delete Context only, will delete the context\n Context + vars, will delete the context vars\n Vars only, will delete the environment vars\n -ot, --owner-type <owner_type> [default: organization]\n --debug\n --help Show this message and exit.\n```\n\n### Examples\n\n#### List project environment variables\n```\n$ circleci-env-cli -p github/myorg/myproject -l\n>\nKEY1\nKEY2\n```\n\n#### Add project environment variables\n```\n$ circleci-env-cli -p github/myorg/myproject -e KEY1=VAL1 -e KEY2=VAL2 -ef project.envs.txt\n> Successfully add/update variable: KEY1\n> Successfully add/update variable: KEY2\n> Successfully add/update variable: KEY3\n> Successfully add/update variable: KEY4\n```\n\n#### Delete project environment variables\n```\n$ circleci-env-cli -p github/myorg/myproject -e KEY1 -e KEY2 -d\n> Successfully delete variable: KEY1\n> Successfully delete variable: KEY2\n```\n\n#### List context variables\n```\n$ circleci-env-cli -p github/myorg/myproject -c mycontext -l\n>\nKEY1\nKEY2\n```\n\n#### Create/update context and add variables\n```\n$ circleci-env-cli -p github/myorg/myproject -c mycontext -e KEY1=VAL1 -e KEY2=VAL2\nThe context named \"mycontext\" was not found. Do you want to create it? [y/n]: y\n> Successfully create context: mycontext\n> Successfully add/update context variable: KEY1\n> Successfully add/update context variable: KEY2\n```\n\n#### Delete context variables\n```\n$ circleci-env-cli -p github/myorg/myproject -c mycontext -e KEY1 -e KEY2 -d\n> Successfully delete context variable: KEY1\n> Successfully delete context variable: KEY2\n```\n\n#### Delete context\n```\n$ circleci-env-cli -p github/myorg/myproject -c mycontext -d\nAre you sure want to delete the context \"mycontext\"? [y/n]: y\n> Successfully delete context\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CLI tool for manage CircleCI contexts and environment vars",
"version": "0.2.0",
"split_keywords": [
"circleci",
"cli",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c218bf446d8e091bc3d5bb3e2e0d0dade954a5c4c8640298396ddcd3922dc63a",
"md5": "0087e229065364c0f006ad4256b96d05",
"sha256": "02c3bb6d1f33792738ab75738e67fb96db96689cd6557a5196ca464593c374f0"
},
"downloads": -1,
"filename": "circleci_env_cli-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0087e229065364c0f006ad4256b96d05",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5895,
"upload_time": "2023-02-05T21:01:57",
"upload_time_iso_8601": "2023-02-05T21:01:57.217832Z",
"url": "https://files.pythonhosted.org/packages/c2/18/bf446d8e091bc3d5bb3e2e0d0dade954a5c4c8640298396ddcd3922dc63a/circleci_env_cli-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f63f27f83dc51a98206fa4a1ff1d8b4872b5c17eda281b72a63780b7769db9c2",
"md5": "af1685eb4a73d4378b1dc687ab7eaa6d",
"sha256": "638595fa09efbb6ee975878119dc8c024b30e39d57e1735c6024efba02f2fa57"
},
"downloads": -1,
"filename": "circleci-env-cli-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "af1685eb4a73d4378b1dc687ab7eaa6d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5205,
"upload_time": "2023-02-05T21:01:58",
"upload_time_iso_8601": "2023-02-05T21:01:58.531458Z",
"url": "https://files.pythonhosted.org/packages/f6/3f/27f83dc51a98206fa4a1ff1d8b4872b5c17eda281b72a63780b7769db9c2/circleci-env-cli-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-05 21:01:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "phsmith",
"github_project": "circleci-env-cli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "click",
"specs": [
[
"==",
"8.1.3"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.28.2"
]
]
},
{
"name": "pycircleci",
"specs": [
[
"==",
"0.6.0"
]
]
}
],
"lcname": "circleci-env-cli"
}