Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/commands/field-add-content-relationship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ const config = {
supported for fields inside groups (e.g. --field
authors.name).
`,
EXAMPLES: `
Allow any document:
prismic field add content-relationship author --to-type blog_post

Restrict to a specific type:
prismic field add content-relationship category --to-type blog_post --custom-type blog_category

Fetch fields from the related document:
prismic field add content-relationship author --to-type blog_post --custom-type author --field name --field bio
`,
},
positionals: {
id: { description: "Field ID", required: true },
Expand Down
12 changes: 12 additions & 0 deletions src/commands/field-add-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ const config = {
name: "prismic field add link",
description:
"Add a link field to a slice or custom type. Use for navigational links to URLs, documents, or media. For data-level relations between documents, use content-relationship instead.",
sections: {
EXAMPLES: `
Add a link that opens in a new tab:
prismic field add link cta --to-type landing_page --allow-target-blank

Restrict to media links only:
prismic field add link download --to-type blog_post --allow media

Add a repeatable link with custom text:
prismic field add link nav_item --to-type navigation --repeatable --allow-text
`,
},
positionals: {
id: { description: "Field ID", required: true },
},
Expand Down
7 changes: 7 additions & 0 deletions src/commands/field-add-rich-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ const config = {
paragraph, strong, em, preformatted, hyperlink, image, embed,
list-item, o-list-item, rtl
`,
EXAMPLES: `
Add a title field (single heading):
prismic field add rich-text title --to-type blog_post --allow heading1 --single

Add a body field with only headings and paragraphs:
prismic field add rich-text body --to-type blog_post --allow heading1,heading2,paragraph,strong,em,hyperlink
`,
},
positionals: {
id: { description: "Field ID", required: true },
Expand Down
9 changes: 9 additions & 0 deletions src/commands/field-add-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ import { getRepositoryName } from "../project";
const config = {
name: "prismic field add select",
description: "Add a select field to a slice or custom type.",
sections: {
EXAMPLES: `
Add a select with options:
prismic field add select theme --to-type landing_page --option light --option dark --option brand

With a default value:
prismic field add select layout --to-type landing_page --option full --option centered --option sidebar --default-value full
`,
},
positionals: {
id: { description: "Field ID", required: true },
},
Expand Down
10 changes: 10 additions & 0 deletions src/commands/field-edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ const config = {
type will be applied. See \`prismic field add <type> --help\`
for type-specific option details.
`,
EXAMPLES: `
Rename a field's label:
prismic field edit title --from-type blog_post --label "Page Title"

Change a select field's options:
prismic field edit theme --from-type landing_page --option light --option dark

Restrict a rich text field to a single block:
prismic field edit subtitle --from-type blog_post --single
`,
},
positionals: {
id: { description: "Field ID", required: true },
Expand Down
9 changes: 9 additions & 0 deletions src/commands/slice-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ import { getRepositoryName } from "../project";
const config = {
name: "prismic slice connect",
description: "Connect a slice to a type's slice zone.",
sections: {
EXAMPLES: `
Connect a slice to a type's default slice zone:
prismic slice connect hero --to blog_post

Connect to a named slice zone:
prismic slice connect hero --to blog_post --slice-zone page_slices
`,
},
positionals: {
id: { description: "ID of the slice", required: true },
},
Expand Down
10 changes: 10 additions & 0 deletions src/commands/type-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ const config = {
page). Includes a slice zone and SEO & Metadata tab by
default, and configures a route in prismic.config.json.
`,
EXAMPLES: `
Create a page type:
prismic type create "Blog Post" --format page

Create a singleton custom type:
prismic type create Settings --single

Create with a custom ID:
prismic type create "Landing Page" --format page --id landing
`,
},
} satisfies CommandConfig;

Expand Down
10 changes: 10 additions & 0 deletions src/commands/webhook-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ const config = {

If no triggers specified, all are enabled.
`,
EXAMPLES: `
Create a webhook for all events:
prismic webhook create https://example.com/webhook

Create a webhook for specific events:
prismic webhook create https://example.com/webhook -t documentsPublished -t documentsUnpublished

Create a named webhook with a secret:
prismic webhook create https://example.com/webhook --name "Deploy" --secret my-secret
`,
},
} satisfies CommandConfig;

Expand Down