Skip to content

CLI: Media

Commands to upload, list, change, and delete media. Common flags that you can add to any command (--host, --json, and others) are in the CLI command reference.

For how to use them, see Upload media with the CLI.

Command Description
hakocms-cli media delete Delete media
hakocms-cli media get Get media
hakocms-cli media list List media
hakocms-cli media update Change the alt text and tags of media
hakocms-cli media upload Upload media. You can pass many files (sent one at a time)
hakocms-cli media usages Entries that use the media

Delete media.

ターミナルウィンドウ
hakocms-cli media delete [OPTIONS] <ID>
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
<ID> ID
--force Do it without asking for confirmation

Get media.

ターミナルウィンドウ
hakocms-cli media get [OPTIONS] <ID>
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
<ID> ID

List media.

ターミナルウィンドウ
hakocms-cli media list [OPTIONS]
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
--query <TEXT> Search by file name, alt text, and tags
--tag <TEXT> Media that have this tag
--kind <TEXT> image or file
--limit <N> Number of items to output (default 30)
--all Follow all pages

Change the alt text and tags of media.

ターミナルウィンドウ
hakocms-cli media update [OPTIONS] <ID>
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
<ID> ID
--alt <TEXT> Alt text
--tags <JSON> Tags (an array of strings). If given, replaces the existing tags. Use @file to read from a file, - to read from standard input
--data <JSON> The whole body (JSON). Use @file to read from a file, - to read from standard input. Other flags are applied on top of it

Upload media. You can pass many files (sent one at a time).

If one fails partway, it stops there (files already sent remain)

ターミナルウィンドウ
hakocms-cli media upload [OPTIONS] <FILE>...
Flag or argument Description
<FILE> Files to send
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
--alt <TEXT> Alt text (applied to every file)
--tags <JSON> Tags (a JSON array of strings, [“news”,“top”])

Entries that use the media.

ターミナルウィンドウ
hakocms-cli media usages [OPTIONS] <ID>
Flag or argument Description
-s, --space <SLUG> Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order
<ID> ID