Skip to content

Commit 9b7e62b

Browse files
nelsonwittwerclaude
andcommitted
Add global flags (--verbose, --no-color) to fetch-doc and search
These commands previously rejected the CLI's standard global flags. Adding `globalFlags` makes them consistent with the rest of the CLI and lets `--verbose` surface the Monorail analytics payload for local verification. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8c58c0c commit 9b7e62b

7 files changed

Lines changed: 107 additions & 3 deletions

File tree

docs-shopify.dev/commands/interfaces/fetch-doc.interface.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,16 @@ export interface fetchdoc {
99
* @environment SHOPIFY_FLAG_CONTENT_TYPE
1010
*/
1111
'--content-type <value>'?: string
12+
13+
/**
14+
* Disable color output.
15+
* @environment SHOPIFY_FLAG_NO_COLOR
16+
*/
17+
'--no-color'?: ''
18+
19+
/**
20+
* Increase the verbosity of the output.
21+
* @environment SHOPIFY_FLAG_VERBOSE
22+
*/
23+
'--verbose'?: ''
1224
}

docs-shopify.dev/commands/interfaces/search.interface.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,15 @@
44
* @publicDocs
55
*/
66
export interface search {
7+
/**
8+
* Disable color output.
9+
* @environment SHOPIFY_FLAG_NO_COLOR
10+
*/
11+
'--no-color'?: ''
712

13+
/**
14+
* Increase the verbosity of the output.
15+
* @environment SHOPIFY_FLAG_VERBOSE
16+
*/
17+
'--verbose'?: ''
818
}

docs-shopify.dev/generated/generated_docs_data_v2.json

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2757,9 +2757,27 @@
27572757
"description": "The Accept content type to request (defaults to text/markdown).",
27582758
"isOptional": true,
27592759
"environmentValue": "SHOPIFY_FLAG_CONTENT_TYPE"
2760+
},
2761+
{
2762+
"filePath": "docs-shopify.dev/commands/interfaces/fetch-doc.interface.ts",
2763+
"syntaxKind": "PropertySignature",
2764+
"name": "--no-color",
2765+
"value": "''",
2766+
"description": "Disable color output.",
2767+
"isOptional": true,
2768+
"environmentValue": "SHOPIFY_FLAG_NO_COLOR"
2769+
},
2770+
{
2771+
"filePath": "docs-shopify.dev/commands/interfaces/fetch-doc.interface.ts",
2772+
"syntaxKind": "PropertySignature",
2773+
"name": "--verbose",
2774+
"value": "''",
2775+
"description": "Increase the verbosity of the output.",
2776+
"isOptional": true,
2777+
"environmentValue": "SHOPIFY_FLAG_VERBOSE"
27602778
}
27612779
],
2762-
"value": "export interface fetchdoc {\n /**\n * The Accept content type to request (defaults to text/markdown).\n * @environment SHOPIFY_FLAG_CONTENT_TYPE\n */\n '--content-type <value>'?: string\n}"
2780+
"value": "export interface fetchdoc {\n /**\n * The Accept content type to request (defaults to text/markdown).\n * @environment SHOPIFY_FLAG_CONTENT_TYPE\n */\n '--content-type <value>'?: string\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
27632781
}
27642782
},
27652783
"help": {
@@ -4146,8 +4164,27 @@
41464164
"name": "search",
41474165
"description": "The following flags are available for the `search` command:",
41484166
"isPublicDocs": true,
4149-
"members": [],
4150-
"value": "export interface search {\n\n}"
4167+
"members": [
4168+
{
4169+
"filePath": "docs-shopify.dev/commands/interfaces/search.interface.ts",
4170+
"syntaxKind": "PropertySignature",
4171+
"name": "--no-color",
4172+
"value": "''",
4173+
"description": "Disable color output.",
4174+
"isOptional": true,
4175+
"environmentValue": "SHOPIFY_FLAG_NO_COLOR"
4176+
},
4177+
{
4178+
"filePath": "docs-shopify.dev/commands/interfaces/search.interface.ts",
4179+
"syntaxKind": "PropertySignature",
4180+
"name": "--verbose",
4181+
"value": "''",
4182+
"description": "Increase the verbosity of the output.",
4183+
"isOptional": true,
4184+
"environmentValue": "SHOPIFY_FLAG_VERBOSE"
4185+
}
4186+
],
4187+
"value": "export interface search {\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
41514188
}
41524189
},
41534190
"storeauth": {

packages/cli/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,8 @@ ARGUMENTS
12271227
FLAGS
12281228
--content-type=<value> [env: SHOPIFY_FLAG_CONTENT_TYPE] The Accept content type to request (defaults to
12291229
text/markdown).
1230+
--no-color [env: SHOPIFY_FLAG_NO_COLOR] Disable color output.
1231+
--verbose [env: SHOPIFY_FLAG_VERBOSE] Increase the verbosity of the output.
12301232
12311233
DESCRIPTION
12321234
Download a complete document from shopify.dev. Every page on shopify.dev has a Markdown version, and that is what this
@@ -2118,6 +2120,10 @@ Search shopify.dev for the most relevant content matching a query. Best for disc
21182120
USAGE
21192121
$ shopify search [query]
21202122
2123+
FLAGS
2124+
--no-color [env: SHOPIFY_FLAG_NO_COLOR] Disable color output.
2125+
--verbose [env: SHOPIFY_FLAG_VERBOSE] Increase the verbosity of the output.
2126+
21212127
DESCRIPTION
21222128
Search shopify.dev for the most relevant content matching a query. Best for discovery — surfacing the relevant pieces
21232129
of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use

packages/cli/oclif.manifest.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3557,6 +3557,22 @@
35573557
"multiple": false,
35583558
"name": "content-type",
35593559
"type": "option"
3560+
},
3561+
"no-color": {
3562+
"allowNo": false,
3563+
"description": "Disable color output.",
3564+
"env": "SHOPIFY_FLAG_NO_COLOR",
3565+
"hidden": false,
3566+
"name": "no-color",
3567+
"type": "boolean"
3568+
},
3569+
"verbose": {
3570+
"allowNo": false,
3571+
"description": "Increase the verbosity of the output.",
3572+
"env": "SHOPIFY_FLAG_VERBOSE",
3573+
"hidden": false,
3574+
"name": "verbose",
3575+
"type": "boolean"
35603576
}
35613577
},
35623578
"hasDynamicHelp": false,
@@ -5693,6 +5709,22 @@
56935709
"# open the search modal on Shopify.dev\n shopify search\n\n # search for a term on Shopify.dev\n shopify search <query>\n\n # search for a phrase on Shopify.dev\n shopify search \"<a search query separated by spaces>\"\n "
56945710
],
56955711
"flags": {
5712+
"no-color": {
5713+
"allowNo": false,
5714+
"description": "Disable color output.",
5715+
"env": "SHOPIFY_FLAG_NO_COLOR",
5716+
"hidden": false,
5717+
"name": "no-color",
5718+
"type": "boolean"
5719+
},
5720+
"verbose": {
5721+
"allowNo": false,
5722+
"description": "Increase the verbosity of the output.",
5723+
"env": "SHOPIFY_FLAG_VERBOSE",
5724+
"hidden": false,
5725+
"name": "verbose",
5726+
"type": "boolean"
5727+
}
56965728
},
56975729
"hasDynamicHelp": false,
56985730
"hiddenAliases": [

packages/cli/src/cli/commands/fetch-doc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {fetchDocService} from '../services/commands/fetch-doc.js'
22
import Command from '@shopify/cli-kit/node/base-command'
3+
import {globalFlags} from '@shopify/cli-kit/node/cli'
34
import {Args, Flags} from '@oclif/core'
45

56
export default class FetchDoc extends Command {
@@ -26,6 +27,7 @@ export default class FetchDoc extends Command {
2627
}
2728

2829
static flags = {
30+
...globalFlags,
2931
'content-type': Flags.string({
3032
description: 'The Accept content type to request (defaults to text/markdown).',
3133
env: 'SHOPIFY_FLAG_CONTENT_TYPE',

packages/cli/src/cli/commands/search.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {searchService} from '../services/commands/search.js'
22
import Command from '@shopify/cli-kit/node/base-command'
3+
import {globalFlags} from '@shopify/cli-kit/node/cli'
34
import {Args} from '@oclif/core'
45

56
export default class Search extends Command {
@@ -24,6 +25,10 @@ export default class Search extends Command {
2425
query: Args.string(),
2526
}
2627

28+
static flags = {
29+
...globalFlags,
30+
}
31+
2732
async run(): Promise<void> {
2833
const {args} = await this.parse(Search)
2934
await searchService(args.query)

0 commit comments

Comments
 (0)