Skip to content

Commit fa94c9f

Browse files
authored
Merge pull request #177 from appwrite/feat-update-cli-readme
feat: improve CLI development docs
2 parents c1d5f59 + 855441b commit fa94c9f

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

templates/cli/README.md.twig

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ $ {{ language.params.executableName }} init
4343

4444
The CLI requires an endpoint, project ID, API key and a locale to be able to communicate with the {{ spec.title | caseUcfirst }} backend server. There are two ways to achieve this
4545

46-
### 1. Pass in the project settings along with `appwrite init`
46+
### 1. Pass in the project settings along with `{{ language.params.executableName }} init`
4747

4848
```sh
4949
$ {{ language.params.executableName }} init --endpoint="YOUR ENDPOINT" --project="YOUR PROJECT ID" --key="YOUR API KEY" --locale="YOUR LOCALE"
@@ -58,7 +58,7 @@ Invoking `{{ language.params.executableName }} init` without any params triggers
5858
### Note
5959
By default, requests to domains with self signed SSL certificates (or no certificates) are disabled. If you trust the domain, you can bypass the certificate validation by using
6060
```sh
61-
$ appwrite client setSelfSigned --value=true
61+
$ {{ language.params.executableName }} client setSelfSigned --value=true
6262
```
6363

6464
## Usage
@@ -107,6 +107,53 @@ $ {{ language.params.executableName }} account get --help
107107

108108
This library is auto-generated by {{ spec.title | caseUcfirst }} custom [SDK Generator](https://github.com/{{ spec.title | lower }}/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/{{ spec.title | lower }}/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.
109109

110+
To build and test the CLI for development, follow these steps
111+
112+
1. Clone the SDK Generator
113+
```sh
114+
$ git clone https://github.com/{{ spec.title | lower }}/sdk-generator
115+
```
116+
117+
2. Ensure that docker is running locally and then run
118+
```sh
119+
$ cd sdk-generator
120+
121+
# Install the composer dependencies
122+
$ docker run --rm --interactive --tty --volume "$(pwd)":/app composer install --ignore-platform-reqs --optimize-autoloader --no-plugins --no-scripts --prefer-dist
123+
124+
# Generate the SDKs
125+
$ docker run --rm -v $(pwd):/app -w /app php:7.4-cli php example.php
126+
```
127+
128+
3. Head over to the generated SDK and build the CLI docker image
129+
```sh
130+
$ cd examples/CLI
131+
$ docker build -t {{ spec.title | lower }}/cli .
132+
```
133+
134+
4. Install the CLI
135+
136+
MacOS and Linux
137+
138+
Open `install.sh` and change [this line](https://github.com/{{ spec.title | lower }}/sdk-for-cli/blob/master/install.sh#L33) to `{{ spec.title | upper }}_CLI_IMAGE_VERSION=latest` and
139+
comment [these lines](https://github.com/{{ spec.title | lower }}/sdk-for-cli/blob/master/install.sh#L119-L123).
140+
141+
You can now install the CLI using
142+
```sh
143+
$ chmod +x install.sh
144+
$ ./install.sh
145+
```
146+
147+
Windows
148+
149+
Open `install.ps1` and change [this line](https://github.com/{{ spec.title | lower }}/sdk-for-cli/blob/master/install.ps1#L28) to `{{ spec.title | upper }}_CLI_IMAGE_VERSION=latest` and
150+
comment [these lines](https://github.com/{{ spec.title | lower }}/sdk-for-cli/blob/master/install.ps1#L85-L89)
151+
152+
You can now install the CLI using
153+
```sh
154+
$ ./install.ps1
155+
```
156+
110157
## License
111158

112159
Please see the [{{spec.licenseName}} license]({{spec.licenseURL}}) file for more information.

0 commit comments

Comments
 (0)