@guardian/grid-cli
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

@guardian/grid-cli

Helpful commands for interacting with Grid, The Guardian's image management tool.

oclif Version Downloads/week License

Installing

grid-cli can be installed using either NPM or Brew

NPM

npm install -g @guardian/grid-cli

Usage

$ 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]

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 FAILURES

Reads a text file containing image ids, and sets their usage rights.

USAGE
  $ grid bulk:rights INPUT RIGHTS OUTPUT FAILURES

ARGUMENTS
  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 NAME

Add a root collection

USAGE
  $ grid collection:add-root NAME

ARGUMENTS
  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 TO

Move images from one collection to another

USAGE
  $ grid collection:move-images FROM TO

ARGUMENTS
  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:add

Add a configuration profile

USAGE
  $ grid configuration:add

OPTIONS
  -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:read

Echos current config

USAGE
  $ grid configuration:read

OPTIONS
  -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 ID

Delete an image from Grid

USAGE
  $ grid image:delete ID

ARGUMENTS
  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 ID

describe the command here

USAGE
  $ grid image:download ID

ARGUMENTS
  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 ID

Reingest an image already present in the images bucket

USAGE
  $ grid image:reingest ID

ARGUMENTS
  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 IMAGE

Upload an image to Grid. Can be a local file or a publicly accessible URL

USAGE
  $ grid image:upload IMAGE

ARGUMENTS
  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 ID

View image in the browser

USAGE
  $ grid image:visit ID

ARGUMENTS
  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 URL

Make an authenticated request to a Grid URL. Assumes response is JSON.

USAGE
  $ grid util:curl URL

ARGUMENTS
  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 FILE

Print the ID a file would get if uploaded to Grid

USAGE
  $ grid util:id-file FILE

ARGUMENTS
  FILE  Path to file to upload

OPTIONS
  -h, --help  show CLI help

See code: src/commands/util/id-file.ts

Readme

Keywords

Package Sidebar

Install

npm i @guardian/grid-cli

Weekly Downloads

7

Version

1.4.0

License

MIT

Unpacked Size

75.1 kB

Total Files

55

Last publish

Collaborators

  • joecowton1
  • guardian-developers
  • akash1810
  • reetta
  • sndrs
  • mxdvl