@jinshuju/cli 0.10.0 → 0.11.0

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 CHANGED
@@ -287,7 +287,7 @@ needs the `submit_entries` scope for these.
287
287
 
288
288
  ## Working with files
289
289
 
290
- Four commands take a file. The CLI uploads with its own credential; there is no
290
+ Five commands take a file. The CLI uploads with its own credential; there is no
291
291
  ticket to fetch first.
292
292
 
293
293
  ```bash
@@ -297,6 +297,7 @@ jinshuju entry import --table Vn4xR8 ./rows.csv --map field_1=1 --map field_2=2
297
297
  jinshuju entry create --form Kp7mQ2 --json '{"field_1":"Alice"}' --attach field_5=./id-card.jpg
298
298
  jinshuju form theme set Kp7mQ2 --wallpaper ./bg.png
299
299
  jinshuju opensearch edit Qy7nR3 --header ./banner.png
300
+ jinshuju form image upload ./venue-map.png # answers with a url for an <img> in a form or field description
300
301
  ```
301
302
 
302
303
  ```bash
@@ -1,7 +1,7 @@
1
1
  import { FILTER_OPTION, FILTERS_OPTION, JSON_OPTION, MINE_OPTION, PAGINATION_OPTIONS, SORT_OPTION, UsageError } from '../options.js';
2
2
  import { API, FOLDER_OPTION, LISTING, filters, given, keywords, overriding, paging, payload, refuseWithMine, sort } from './shared.js';
3
3
  import { validateContainerPayload } from '../payload.js';
4
- import { uploadFormImage } from './upload.js';
4
+ import { upload, uploadFormImage } from './upload.js';
5
5
  /**
6
6
  * The shape behind `--json` on a form, shown rather than described: `fields` is
7
7
  * the part nothing else hints at, and one choice field carries more of the
@@ -372,6 +372,16 @@ export const FORM = [
372
372
  'jinshuju form theme set Kp7mQ2 --wallpaper ./bg.png'
373
373
  ]
374
374
  },
375
+ {
376
+ path: ['form', 'image', 'upload'],
377
+ summary: 'Upload an image for a form or field description',
378
+ description: "Answers with a url to put in an <img src> inside a form's description or a field's notes. " +
379
+ 'The image belongs to the first form saved with a description that refers to it; one that no ' +
380
+ 'form takes within 7 days is removed.',
381
+ args: [{ name: 'file', required: true, description: 'Image file' }],
382
+ request: (input) => upload(`${API}/form_image_attachments`, input.args.file, { image_type: 'description' }),
383
+ examples: ['jinshuju form image upload ./venue-map.png']
384
+ },
375
385
  {
376
386
  path: ['form', 'rule', 'get'],
377
387
  summary: 'Show the field display rules of a form',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinshuju/cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Command line interface for Jinshuju Open API v1",
5
5
  "homepage": "https://github.com/jinshuju/cli#readme",
6
6
  "bugs": {