You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-23Lines changed: 33 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,16 @@
1
1
# Elastic Path Composable Commerce Command Line Interface
2
2
3
-
4
3
## Overview
5
-
This project is designed as a tool for power users to interact with the [Elastic Path Composable Commerce API](https://documentation.elasticpath.com/commerce-cloud/docs/api/) via the command line and the project is designed to fill three distinct niches:
4
+
5
+
This project is designed as a tool for power users to interact with the [Elastic Path Composable Commerce API](https://documentation.elasticpath.com/commerce-cloud/docs/api/) via the command line and the project is designed to fill three distinct
6
+
niches:
7
+
6
8
1. Provide a fast way for users familiar with the API to interact with it.
7
9
2. Provide a simpler way to do scripting with the API (i.e., instead of using curl and creating JSON in the shell)
8
10
3. Provide a reusable set of scripts for creating data sets with [Runbooks](docs/runbook-development.md).
9
11
10
-
This tool is not meant for new users unfamiliar with the API, new users are highly encouraged to use the [Elastic Path Composable Commerce Postman Collection](https://elasticpath.dev/docs/commerce-cloud/api-overview/test-with-postman-collection) instead of this tool.
12
+
This tool is not meant for new users unfamiliar with the API, new users are highly encouraged to use the [Elastic Path Composable Commerce Postman Collection](https://elasticpath.dev/docs/commerce-cloud/api-overview/test-with-postman-collection)
13
+
instead of this tool.
11
14
12
15
Additionally, this tool is not necessarily meant to be a new command line equivalent of Commerce Manager, it should just feel at all times like you are interacting with a JSON based REST API.
13
16
@@ -26,6 +29,7 @@ It is highly recommended that new users check out the [Tutorial](docs/tutorial.m
26
29
The following is a summary of the main commands, in general you can type `epcc help` to get an updated list and see all commands as well as flags.
|`epcc docs <RESOURCE>`| Open the API docs for a resource in your browser |
@@ -66,21 +71,21 @@ The following is a summary of the main commands, in general you can type `epcc h
66
71
1.`--execution-timeout` will control how long the `epcc` process can run before timing out.
67
72
2.`--rate-limit` will control the number of requests per second to EPCC.
68
73
3.`--max-concurrency` will control the maximum number of concurrent commands that can run simultaneously.
69
-
* This differs from the rate limit in that if a request takes 2 seconds, a rate limit of 3 will allow 6 requests in flight at a time, whereas `--max-concurrency` would limit you to 3. A higher value will slow down initial start time.
74
+
* This differs from the rate limit in that if a request takes 2 seconds, a rate limit of 3 will allow 6 requests in flight at a time, whereas `--max-concurrency` would limit you to 3. A higher value will slow down initial start time.
70
75
71
76
#### Headers
72
77
73
78
Headers can be set in one of three ways, depending on what is most convenient
74
79
75
80
1. Via the `-H` argument.
76
-
* This header will be one time only.
81
+
* This header will be one time only.
77
82
2. Via the `EPCC_CLI_HTTP_HEADER_0` environment variable.
78
-
* This header will be always be set.
83
+
* This header will be always be set.
79
84
3. Via the `epcc header set`
80
-
* These headers will be set in the current profile and will stay until unset. You can see what headers are set with `epcc headers status`
81
-
* Headers set this way support aliases.
82
-
* You can also additionally group headers into groups with `--group` and then clear all headers with `epcc headers clear <GROUP>`
83
-
85
+
* These headers will be set in the current profile and will stay until unset. You can see what headers are set with `epcc headers status`
86
+
* Headers set this way support aliases.
87
+
* You can also additionally group headers into groups with `--group` and then clear all headers with `epcc headers clear <GROUP>`
88
+
84
89
### Configuration
85
90
86
91
#### Via Prompts
@@ -91,16 +96,18 @@ Run the `epcc configure` and it will prompt you for the required settings, when
91
96
92
97
The following environment variables can be set up to control which environment and store to use with the EPCC CLI.
| EPCC_API_BASE_URL | This is the API base URL which can be retrieved via CM. |
97
-
| EPCC_BETA_API_FEATURES | This variable allows you to set [Beta Headers](https://documentation.elasticpath.com/commerce-cloud/docs/api/basics/api-contract.html#beta-apis) for all API calls. |
98
-
| EPCC_CLI_HTTP_HEADER_**N**| Setting any environment variable like this (where N is a number) will cause it's value to be parsed and added to all HTTP headers (e.g., `EPCC_CLI_HTTP_HEADER_0=Cache-Control: no-cache` will add `Cache-Control: no-cache` as a header). FYI, the surprising syntax is due to different encoding rules. You can also specify headers using `-H` or `epcc headers`|
99
-
| EPCC_CLI_SUPPRESS_NO_AUTH_MESSAGES | This will supress warning messages about not being authenticated or logged out |
100
-
| EPCC_CLIENT_ID | This is the Client ID which can be retrieved via CM. |
101
-
| EPCC_CLIENT_SECRET | This is the Client Secret which can be retrieved via CM. |
102
-
| EPCC_PROFILE | A profile name that allows for an independent session and isolation (e.g., distinct histories) |
103
-
| EPCC_RUNBOOK_DIRECTORY | A directory that will be scanned for runbook, a runbook ends with `.epcc.yml`|
| EPCC_API_BASE_URL | This is the API base URL which can be retrieved via CM. |
102
+
| EPCC_BETA_API_FEATURES | This variable allows you to set [Beta Headers](https://documentation.elasticpath.com/commerce-cloud/docs/api/basics/api-contract.html#beta-apis) for all API calls. |
103
+
| EPCC_CLI_HTTP_HEADER_**N**| Setting any environment variable like this (where N is a number) will cause it's value to be parsed and added to all HTTP headers (e.g., `EPCC_CLI_HTTP_HEADER_0=Cache-Control: no-cache` will add `Cache-Control: no-cache` as a header). FYI, the surprising syntax is due to different encoding rules. You can also specify headers using `-H` or `epcc headers`. |
104
+
| EPCC_CLI_SUPPRESS_NO_AUTH_MESSAGES | This will supress warning messages about not being authenticated or logged out |
105
+
| EPCC_CLI_URL_MATCH_REGEXP_**N**| Setting this value causes the _path_ section of a URL to be matched and replaced with a corresponding value from the `EPCC_CLI_URL_MATCH_SUBSTITION_**N**` header, if not set the empty string is used. |
106
+
| EPCC_CLI_URL_MATCH_SUBSTITION_**N**| The replacement string to use when a match is found. Capture groups and back references are supported (see [ReplaceAllString](https://pkg.go.dev/regexp#Regexp.ReplaceAllString)). |
107
+
| EPCC_CLIENT_ID | This is the Client ID which can be retrieved via CM. |
108
+
| EPCC_CLIENT_SECRET | This is the Client Secret which can be retrieved via CM. |
109
+
| EPCC_PROFILE | A profile name that allows for an independent session and isolation (e.g., distinct histories). |
110
+
| EPCC_RUNBOOK_DIRECTORY | A directory that will be scanned for runbook, a runbook ends with `.epcc.yml`. |
104
111
105
112
It is recommended to set EPCC_API_BASE_URL, EPCC_CLIENT_ID, and EPCC_CLIENT_SECRET to be able to interact with most things in the CLI.
106
113
@@ -123,7 +130,9 @@ You will need to start a new shell for this setup to take effect
123
130
124
131
#### Bash
125
132
126
-
You will need to have the [bash-completion](https://github.com/scop/bash-completion) (e.g., [Ubuntu](https://packages.ubuntu.com/search?keywords=bash-completion), [Arch](https://archlinux.org/packages/extra/any/bash-completion/), [Gentoo](https://packages.gentoo.org/packages/app-shells/bash-completion)) package installed, and restart your bash session.
133
+
You will need to have the [bash-completion](https://github.com/scop/bash-completion) (
134
+
e.g., [Ubuntu](https://packages.ubuntu.com/search?keywords=bash-completion), [Arch](https://archlinux.org/packages/extra/any/bash-completion/), [Gentoo](https://packages.gentoo.org/packages/app-shells/bash-completion)) package installed, and restart
135
+
your bash session.
127
136
128
137
To load completions for each session, execute once:
129
138
@@ -157,7 +166,6 @@ To load completions for each session, execute once:
157
166
158
167
`epcc completion fish > ~/.config/fish/completions/epcc.fish`
159
168
160
-
161
169
## Tips
162
170
163
171
### JQ Output
@@ -207,6 +215,7 @@ this is based on [GoJQ which has a number of differences](https://github.com/itc
207
215
The `--retry-while-jq` argument can be used to wait for certain conditions to happen (e.g., a catalog publication, or an eventual consistency condition).
208
216
209
217
For example:
218
+
210
219
```bash
211
220
epcc get pcm-catalog-release --retry-while-jq '.data.meta.release_status != "PUBLISHED"' name=Ranges_Catalog last_release
212
221
```
@@ -219,6 +228,7 @@ this is based on [GoJQ which has a number of differences](https://github.com/itc
0 commit comments