CLI: Entries
Commands to create, change, publish, and delete entries, plus commands for revision history and scheduled publishing. 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 Edit and retrieve entries in bulk. The format of values (--data, --set) is in Field types and value formats and Rich text format (Hako Rich Text v1).
| Command | Description |
|---|---|
hakocms-cli entries create |
Create an entry (as a draft, or published) |
hakocms-cli entries delete |
Delete an entry |
hakocms-cli entries discard-draft |
Discard the draft and go back to the published revision |
hakocms-cli entries edit |
Write the entry’s values (the draft, or the published revision if there is no draft) to a JSON file and open it in $VISUAL or $EDITOR |
hakocms-cli entries get |
Get an entry |
hakocms-cli entries list |
List entries |
hakocms-cli entries publish |
Publish an entry |
hakocms-cli entries revisions get |
Get one revision, including its values |
hakocms-cli entries revisions list |
List an entry’s revisions (without values) |
hakocms-cli entries schedule |
Set scheduled publishing and scheduled unpublishing |
hakocms-cli entries unpublish |
Unpublish. The draft remains. If there is no draft, the published values become the draft |
hakocms-cli entries update |
Change an entry’s values and save them as a draft (the same as 「保存」 (Save) in the admin) |
hakocms-cli entries create
Section titled “hakocms-cli entries create”Create an entry (as a draft, or published)
hakocms-cli entries create [OPTIONS] --type <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 |
-t, --type <ID> |
Content type (required) |
--id <TEXT> |
If omitted, an ID is assigned automatically |
--publish[=true|false] |
If true, publish immediately. If false (the default), create it as a draft |
--data <JSON> |
The entry’s values (JSON). Use @file to read from a file, - to read from standard input |
--set <FIELD=VALUE> |
A field value. If the value parses as JSON, that value is used; otherwise it is a string (–set count=3 is a number, –set title=hello is a string) |
hakocms-cli entries delete
Section titled “hakocms-cli entries delete”Delete an entry.
hakocms-cli entries delete [OPTIONS] --type <ID> <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 |
-t, --type <ID> |
Content type (required) |
<ID> |
ID |
--force |
Do it without asking for confirmation |
hakocms-cli entries discard-draft
Section titled “hakocms-cli entries discard-draft”Discard the draft and go back to the published revision.
hakocms-cli entries discard-draft [OPTIONS] --type <ID> <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 |
-t, --type <ID> |
Content type (required) |
<ID> |
ID |
--force |
Do it without asking for confirmation |
hakocms-cli entries edit
Section titled “hakocms-cli entries edit”Write the entry’s values (the draft, or the published revision if there is no draft) to a JSON file and open it in $VISUAL or $EDITOR.
When you save and close, the values are saved as a draft (nothing happens if you made no changes). With –publish, the entry is published with those values.
hakocms-cli entries edit [OPTIONS] <ID> --type <ID>| Flag or argument | Description |
|---|---|
<ID> |
Entry ID |
-s, --space <SLUG> |
Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order |
-t, --type <ID> |
Content type (required) |
--publish |
Publish instead of saving as a draft |
hakocms-cli entries get
Section titled “hakocms-cli entries get”Get an entry.
hakocms-cli entries get [OPTIONS] --type <ID> <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 |
-t, --type <ID> |
Content type (required) |
<ID> |
ID |
hakocms-cli entries list
Section titled “hakocms-cli entries list”List entries.
hakocms-cli entries list [OPTIONS] --type <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 |
-t, --type <ID> |
Content type (required) |
--query <TEXT> |
Full-text search |
--status <TEXT> |
published draft closed reserved, comma-separated (matches any of them) |
--orders <TEXT> |
updatedAt publishedAt createdAt. Prefix with - for descending order |
--limit <N> |
Number of items to output (default 30) |
--all |
Follow all pages |
hakocms-cli entries publish
Section titled “hakocms-cli entries publish”Publish an entry.
hakocms-cli entries publish [OPTIONS] --type <ID> <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 |
-t, --type <ID> |
Content type (required) |
<ID> |
ID |
--data <JSON> |
The entry’s values (JSON). Use @file to read from a file, - to read from standard input |
--set <FIELD=VALUE> |
A field value. If the value parses as JSON, that value is used; otherwise it is a string (–set count=3 is a number, –set title=hello is a string) |
hakocms-cli entries revisions get
Section titled “hakocms-cli entries revisions get”Get one revision, including its values.
Gets one revision of an entry, including its values.
Use it to compare with an earlier revision or to go back to an earlier revision.
hakocms-cli entries revisions get [OPTIONS] --type <ID> --entry <TEXT> <REVISION_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 |
-t, --type <ID> |
Content type (required) |
--entry <TEXT> |
ID (required) |
<REVISION_ID> |
Revision ID |
hakocms-cli entries revisions list
Section titled “hakocms-cli entries revisions list”List an entry’s revisions (without values)
Lists an entry’s revisions.
Values are not included. Get the values of one revision with GET .../revisions/{revision_id} (entries revisions get in the CLI). cursor is the last revision number on the previous page.
hakocms-cli entries revisions list [OPTIONS] --type <ID> --entry <TEXT>| 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 |
-t, --type <ID> |
Content type (required) |
--entry <TEXT> |
ID (required) |
--limit <N> |
Number of items to output (default 30) |
--all |
Follow all pages |
hakocms-cli entries schedule
Section titled “hakocms-cli entries schedule”Set scheduled publishing and scheduled unpublishing.
Fields you omit are not changed. Passing null cancels that schedule.
hakocms-cli entries schedule [OPTIONS] --type <ID> <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 |
-t, --type <ID> |
Content type (required) |
<ID> |
ID |
--close-at <TEXT> |
Date and time for scheduled unpublishing (RFC 3339). null cancels it. If omitted, unchanged |
--publish-at <TEXT> |
Date and time for scheduled publishing (RFC 3339). null cancels it. If omitted, unchanged |
--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 |
hakocms-cli entries unpublish
Section titled “hakocms-cli entries unpublish”Unpublish. The draft remains. If there is no draft, the published values become the draft.
hakocms-cli entries unpublish [OPTIONS] --type <ID> <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 |
-t, --type <ID> |
Content type (required) |
<ID> |
ID |
hakocms-cli entries update
Section titled “hakocms-cli entries update”Change an entry’s values and save them as a draft (the same as 「保存」 (Save) in the admin).
Applies the –set fields on top of the current values (the draft, or the published revision if there is no draft). If you pass –data, it is used instead of the current values. With –publish, the entry is published with those values instead of being saved as a draft.
hakocms-cli entries update [OPTIONS] <ID> --type <ID>| Flag or argument | Description |
|---|---|
<ID> |
Entry ID |
-s, --space <SLUG> |
Space. If omitted: HAKOCMS_SPACE, hakocms-cli.toml, then the one set with spaces use, in that order |
-t, --type <ID> |
Content type (required) |
--data <JSON> |
All of the entry’s values (JSON). Use @file to read from a file, - to read from standard input |
--set <FIELD=VALUE> |
A field value. If the value parses as JSON, that value is used; otherwise it is a string (–set count=3 is a number, –set title=hello is a string) |
--publish |
Publish instead of saving as a draft |