@hardfin/cli 0.1.1-dev.56 → 0.1.1-dev.58
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 +39 -2
- package/dist/cli.js +4 -4
- package/dist/completion-tree.json +29 -0
- package/dist/{program-CI4W2agw.js → program-C2DP0mVy.js} +1037 -903
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,7 +79,8 @@ Inside a `key=value` flag, `=` gives a value as you typed it and `:=` gives it a
|
|
|
79
79
|
| `value=36` | the text "36", because a custom field may hold a serial number |
|
|
80
80
|
| `value:=36` | the number 36 |
|
|
81
81
|
| `value:=true` | the boolean true |
|
|
82
|
-
| `deliverAt
|
|
82
|
+
| `deliverAt=null` | null, because the field takes it |
|
|
83
|
+
| `deliverAt="null"` | the text "null" |
|
|
83
84
|
| `order=2` or `order:=2` | the number 2, because the document types `order` as a whole number |
|
|
84
85
|
|
|
85
86
|
A value the field does not take fails locally with exit code 2, such as `order=two`, or
|
|
@@ -104,7 +105,18 @@ hardfin location create --input location.json
|
|
|
104
105
|
echo '{"name": "Dock 4, north side"}' | hardfin location create --input -
|
|
105
106
|
```
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
The word `null` clears a field the API takes null for. It is read before anything else,
|
|
109
|
+
whatever the field holds, and `"null"` in quotes is the text.
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
hardfin asset accounting update ast_4f9xk2mq7plr8stz --useful-life null # clears it
|
|
113
|
+
hardfin asset update ast_4f9xk2mq7plr8stz --description '"null"' # the text null
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
A field the API does not take null for is sent the word as text. The same holds inside a
|
|
117
|
+
`key=value` flag, as in `deliverAt=null`.
|
|
118
|
+
|
|
119
|
+
`--unset` clears a field too, naming the flag:
|
|
108
120
|
|
|
109
121
|
```sh
|
|
110
122
|
hardfin asset accounting update ast_4f9xk2mq7plr8stz --unset useful-life
|
|
@@ -143,6 +155,31 @@ An agent branches on `code`. A code is never renamed and never changes meaning,
|
|
|
143
155
|
message may be reworded at any time. `hardfin agent-guide` lists every code with what it
|
|
144
156
|
means, and `src/output/failure.ts` defines them.
|
|
145
157
|
|
|
158
|
+
### Calling an endpoint no command covers
|
|
159
|
+
|
|
160
|
+
`hardfin api` calls any path under the API. It takes the same parts a generated command does,
|
|
161
|
+
named by hand.
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
hardfin api /customer -f page=2 -f limit=50 # query parameters
|
|
165
|
+
hardfin api -X PATCH /item/item_V1StGXR8Z5jdHi6B --input body.json # a JSON body
|
|
166
|
+
hardfin api /file/file_7hq2mx9pkr4stz8w --output photo.jpg # a download
|
|
167
|
+
hardfin api -X POST /file --file photo.jpg -F fileType=ASSET_FILE # an upload, as multipart
|
|
168
|
+
hardfin api /file/file_7hq2mx9pkr4stz8w -H 'If-None-Match: "abc"' --output photo.jpg
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
| Flag | Sends |
|
|
172
|
+
| ------------------ | ---------------------------------------------------------------------------------- |
|
|
173
|
+
| `-f key=value` | A query parameter, repeatable |
|
|
174
|
+
| `--input <path>` | A JSON body, from a file or `-` for standard input |
|
|
175
|
+
| `--file <path>` | A file as multipart, under the part name `data` unless `--file-part` names another |
|
|
176
|
+
| `-F key=value` | A field beside the file, repeatable |
|
|
177
|
+
| `-H "Name: value"` | A request header, repeatable |
|
|
178
|
+
| `--output <path>` | Nothing. It writes the file the endpoint answers with, or `-` for standard output |
|
|
179
|
+
|
|
180
|
+
A header cannot set `Authorization`, `X-API-Key` or `X-API-Version`, which come from your sign
|
|
181
|
+
in and settings. `--file` and `--input` cannot be given together.
|
|
182
|
+
|
|
146
183
|
### Reading the commands from a program
|
|
147
184
|
|
|
148
185
|
`hardfin agent-guide` describes the CLI to an agent, as Markdown or as JSON. Name a command to
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a7e96225-360e-5093-91ec-0d60c0a9c032")}catch(e){}}();
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
//#region src/cli.ts
|
|
6
6
|
module.enableCompileCache?.();
|
|
@@ -14,7 +14,7 @@ process.on("unhandledRejection", (error) => void toCrash(error));
|
|
|
14
14
|
try {
|
|
15
15
|
const answer = await toQuickAnswer(process.argv.slice(2));
|
|
16
16
|
if (answer === void 0) {
|
|
17
|
-
const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-
|
|
17
|
+
const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-C2DP0mVy.js");
|
|
18
18
|
try {
|
|
19
19
|
await toCli().parseAsync(process.argv);
|
|
20
20
|
} catch (error) {
|
|
@@ -33,7 +33,7 @@ async function toCrash(error) {
|
|
|
33
33
|
isCrashing = true;
|
|
34
34
|
const isJSON = process.argv.includes("--json") || !process.stdout.isTTY;
|
|
35
35
|
try {
|
|
36
|
-
const { toReported, writeCrash } = await import("./program-
|
|
36
|
+
const { toReported, writeCrash } = await import("./program-C2DP0mVy.js");
|
|
37
37
|
writeCrash(error, isJSON);
|
|
38
38
|
await toReported(error, isJSON, void 0, "fatal");
|
|
39
39
|
} catch {
|
|
@@ -54,4 +54,4 @@ async function toQuickAnswer(args) {
|
|
|
54
54
|
export {};
|
|
55
55
|
|
|
56
56
|
//# sourceMappingURL=cli.js.map
|
|
57
|
-
//# debugId=
|
|
57
|
+
//# debugId=a7e96225-360e-5093-91ec-0d60c0a9c032
|
|
@@ -2566,6 +2566,35 @@
|
|
|
2566
2566
|
"description": "A file holding the JSON request body, or - for stdin",
|
|
2567
2567
|
"valueName": "file"
|
|
2568
2568
|
},
|
|
2569
|
+
{
|
|
2570
|
+
"name": "file",
|
|
2571
|
+
"description": "A file to upload as multipart, in place of a JSON body",
|
|
2572
|
+
"valueName": "path"
|
|
2573
|
+
},
|
|
2574
|
+
{
|
|
2575
|
+
"name": "file-part",
|
|
2576
|
+
"description": "The name of the part the file is sent as, which is data when not given",
|
|
2577
|
+
"valueName": "name"
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
"name": "form",
|
|
2581
|
+
"short": "F",
|
|
2582
|
+
"description": "A field sent beside the file as key=value, repeatable",
|
|
2583
|
+
"valueName": "key=value",
|
|
2584
|
+
"repeatable": true
|
|
2585
|
+
},
|
|
2586
|
+
{
|
|
2587
|
+
"name": "header",
|
|
2588
|
+
"short": "H",
|
|
2589
|
+
"description": "A request header as Name: value, repeatable",
|
|
2590
|
+
"valueName": "name: value",
|
|
2591
|
+
"repeatable": true
|
|
2592
|
+
},
|
|
2593
|
+
{
|
|
2594
|
+
"name": "output",
|
|
2595
|
+
"description": "Where to write a file the endpoint answers with, or - for standard output",
|
|
2596
|
+
"valueName": "path"
|
|
2597
|
+
},
|
|
2569
2598
|
{
|
|
2570
2599
|
"name": "json",
|
|
2571
2600
|
"description": "Print machine-readable output, which is the default when stdout is not a terminal"
|