@hardfin/cli 0.0.2-dev.11 → 0.0.2-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -3
- package/dist/cli.js +1732 -88
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,9 +47,39 @@ and the shape of the last segment decide the verb.
|
|
|
47
47
|
| `PATCH /asset/{assetKey}` | `hardfin asset update <assetKey>` |
|
|
48
48
|
| `PATCH /asset/{assetKey}/accounting` | `hardfin asset accounting update <assetKey>` |
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
Everything an endpoint takes becomes a flag or an argument. No command asks for JSON.
|
|
51
|
+
|
|
52
|
+
| The document says | You type |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| A path parameter | a positional argument |
|
|
55
|
+
| A query or body field | `--field-name`, in kebab case |
|
|
56
|
+
| A field inside a nested object | `--address-city`, the path joined |
|
|
57
|
+
| An array of values | the flag, repeated |
|
|
58
|
+
| An array of objects | the flag, repeated, each carrying that element's fields as `key=value` |
|
|
59
|
+
| A file upload | `--file <path>`, sent as multipart |
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
hardfin asset ownership create ast_4f9xk2mq7plr8stz \
|
|
63
|
+
--customer-id cst_a1 --date 2026-09-23 --sale-price 1500.00
|
|
64
|
+
|
|
65
|
+
hardfin asset move execute create \
|
|
66
|
+
--move assetId=ast_a1,locationId=loc_x \
|
|
67
|
+
--move assetId=ast_b2,locationId=loc_y
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
A value is sent as the type the document names. `--useful-life 36` sends the number 36. A
|
|
71
|
+
decimal such as `--salvage-value 1500.00` stays a string, which is how the API takes money
|
|
72
|
+
without losing precision.
|
|
73
|
+
|
|
74
|
+
Clear a field with `--unset`, naming the flag:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
hardfin asset accounting update ast_4f9xk2mq7plr8stz --unset useful-life
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Three things fail locally with exit code 2, before any request is made: a value outside an
|
|
81
|
+
enum, a required field that is missing, and `--unset` on a field the API will not take null
|
|
82
|
+
for.
|
|
53
83
|
|
|
54
84
|
### Overrides
|
|
55
85
|
|
|
@@ -185,6 +215,17 @@ environment, so `hardfin login` works out of the box.
|
|
|
185
215
|
| `clientId`, or `HARDFIN_CLIENT_ID` | the client this CLI names itself as | the seeded Hardfin CLI client |
|
|
186
216
|
| `issuerUrl`, or `HARDFIN_ISSUER_URL` | the authorization server | the API's host root |
|
|
187
217
|
|
|
218
|
+
## Completing commands in your shell
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
source <(hardfin completion zsh) # this shell, now
|
|
222
|
+
hardfin completion zsh >> ~/.zshrc # every shell after this one
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`bash`, `zsh`, `fish` and `powershell` each get a script. The script asks the CLI what may
|
|
226
|
+
follow what you have typed, so completions never fall behind the commands, including the ones
|
|
227
|
+
generated from the API document.
|
|
228
|
+
|
|
188
229
|
## Serving an agent
|
|
189
230
|
|
|
190
231
|
```sh
|