Helpful commands for interacting with Grid, The Guardian's image management tool.
npm install @guardian/grid-cli@guardian/grid-cli
==========================
Helpful commands for interacting with Grid, The Guardian's image management tool.




* Installing
* Usage
* Developing
* Commands
sh
npm install -g @guardian/grid-cli
``
Usage
`sh-session
$ npm install -g @guardian/grid-cli
$ grid COMMAND
running command...
$ grid (-v|--version|version)
@guardian/grid-cli/1.4.0 darwin-x64 node-v15.3.0
$ grid --help [COMMAND]
USAGE
$ grid COMMAND
...
`
Developing
There are a few handy scripts in the ./script directory.
* new-command.sh which creates new commands, ./scripts/new-command.sh a/b to create a:b
* update-readme.sh which you should run before committing. To run the development build of the script, you can run
npm run local.
Commands
* [grid autocomplete [SHELL]](#grid-autocomplete-shell)
* grid bulk:rights INPUT RIGHTS OUTPUT FAILURES
* grid collection:add-root NAME
* grid collection:move-images FROM TO
* grid configuration:add
* grid configuration:read
* [grid help [COMMAND]](#grid-help-command)
* grid image:delete ID
* grid image:download ID
* [grid image:get [ID]](#grid-imageget-id)
* grid image:reingest ID
* [grid image:search [Q]](#grid-imagesearch-q)
* grid image:upload IMAGE
* grid image:visit ID
* grid util:curl URL
* grid util:id-file FILEgrid autocomplete [SHELL]display autocomplete installation instructions
`
USAGE
$ grid autocomplete [SHELL]ARGUMENTS
SHELL shell type
OPTIONS
-r, --refresh-cache Refresh cache (ignores displaying instructions)
EXAMPLES
$ grid autocomplete
$ grid autocomplete bash
$ grid autocomplete zsh
$ grid autocomplete --refresh-cache
`_See code: @oclif/plugin-autocomplete_
grid bulk:rights INPUT RIGHTS OUTPUT FAILURESReads a text file containing image ids, and sets their usage rights.
`
USAGE
$ grid bulk:rights INPUT RIGHTS OUTPUT FAILURESARGUMENTS
INPUT file to read, containing one grid id per line
RIGHTS (noRights|chargeable) usageRights to set
OUTPUT file to output results to
FAILURES file to write bad ids to
OPTIONS
-f, --field=field key or link name to print from each returned image, if none given then image will be output as
json
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
-t, --thumbnail show a thumbnail
`_See code: src/commands/bulk/rights.ts_
grid collection:add-root NAMEAdd a root collection
`
USAGE
$ grid collection:add-root NAMEARGUMENTS
NAME Root collection to add
OPTIONS
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
`_See code: src/commands/collection/add-root.ts_
grid collection:move-images FROM TOMove images from one collection to another
`
USAGE
$ grid collection:move-images FROM TOARGUMENTS
FROM Collection to rename
TO Name of new collection
OPTIONS
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
`_See code: src/commands/collection/move-images.ts_
grid configuration:addAdd a configuration profile
`
USAGE
$ grid configuration:addOPTIONS
-h, --help show CLI help
-k, --apiKey=apiKey API key
-m, --mediaApiHost=mediaApiHost Hostname for media-api
-p, --profile=profile [default: default] Profile name
`_See code: src/commands/configuration/add.ts_
grid configuration:readEchos current config
`
USAGE
$ grid configuration:readOPTIONS
-a, --all show all profiles
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
`_See code: src/commands/configuration/read.ts_
grid help [COMMAND]display help for grid
`
USAGE
$ grid help [COMMAND]ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
`_See code: @oclif/plugin-help_
grid image:delete IDDelete an image from Grid
`
USAGE
$ grid image:delete IDARGUMENTS
ID ID of image
OPTIONS
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
`_See code: src/commands/image/delete.ts_
grid image:download IDdescribe the command here
`
USAGE
$ grid image:download IDARGUMENTS
ID ID of image
OPTIONS
-d, --directory=directory [default: /tmp] directory to download to
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
`_See code: src/commands/image/download.ts_
grid image:get [ID]Get an Image from the API
`
USAGE
$ grid image:get [ID]ARGUMENTS
ID ID of image
OPTIONS
-f, --field=field key or link name to print from each returned image, if none given then image will be output as
json
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
-t, --thumbnail show a thumbnail
--hydrate Gets fields which are returned as uris.
`_See code: src/commands/image/get.ts_
grid image:reingest IDReingest an image already present in the images bucket
`
USAGE
$ grid image:reingest IDARGUMENTS
ID ID of image
OPTIONS
-c, --compare Do a dry run, and display the difference between the result and the data returned for this
image from media-api
-d, --dryRun Display the result of the reingestion only
-f, --field=field key or link name to print from each returned image, if none given then image will be output as
json
-f, --force Force reingestion if the image is already present in the Grid
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
-t, --thumbnail show a thumbnail
`_See code: src/commands/image/reingest.ts_
grid image:search [Q]Search for an Image from the API
`
USAGE
$ grid image:search [Q]ARGUMENTS
Q Search query
OPTIONS
-f, --field=field key or link name to print from each returned image, if none given then image will be output as
json
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
-t, --thumbnail show a thumbnail
`_See code: src/commands/image/search.ts_
grid image:upload IMAGEUpload an image to Grid. Can be a local file or a publicly accessible URL
`
USAGE
$ grid image:upload IMAGEARGUMENTS
IMAGE Image to upload. If a URL, it must be publicly accessible
OPTIONS
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
`_See code: src/commands/image/upload.ts_
grid image:visit IDView image in the browser
`
USAGE
$ grid image:visit IDARGUMENTS
ID ID of image
OPTIONS
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
`_See code: src/commands/image/visit.ts_
grid util:curl URLMake an authenticated request to a Grid URL. Assumes response is JSON.
`
USAGE
$ grid util:curl URLARGUMENTS
URL The URL to request
OPTIONS
-d, --data=data The body of the request
-h, --help show CLI help
-p, --profile=profile [default: default] Profile name
-x, --method=GET|POST|PUT|PATCH|DELETE [default: GET] The HTTP verb to use
`_See code: src/commands/util/curl.ts_
grid util:id-file FILEPrint the ID a file would get if uploaded to Grid
`
USAGE
$ grid util:id-file FILEARGUMENTS
FILE Path to file to upload
OPTIONS
-h, --help show CLI help
``_See code: src/commands/util/id-file.ts_