Skip to content

Commit

Permalink
Fix json flag polluting stdout in theme profile
Browse files Browse the repository at this point in the history
  • Loading branch information
macournoyer committed Jan 14, 2025
1 parent 1e4e69c commit dbfa8b9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This is an autogenerated file. Don't edit this file manually.
export interface themeprofile {
/**
* Return profiling data as JSON.
* Output the result as JSON.
* @environment SHOPIFY_FLAG_JSON
*/
'-j, --json'?: ''
Expand Down
4 changes: 2 additions & 2 deletions docs-shopify.dev/generated/generated_docs_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -5885,7 +5885,7 @@
"syntaxKind": "PropertySignature",
"name": "-j, --json",
"value": "\"\"",
"description": "Return profiling data as JSON.",
"description": "Output the result as JSON.",
"isOptional": true,
"environmentValue": "SHOPIFY_FLAG_JSON"
},
Expand All @@ -5908,7 +5908,7 @@
"environmentValue": "SHOPIFY_FLAG_THEME_ID"
}
],
"value": "export interface themeprofile {\n /**\n * Return profiling data as JSON.\n * @environment SHOPIFY_FLAG_JSON\n */\n '-j, --json'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Password generated from the Theme Access app.\n * @environment SHOPIFY_CLI_THEME_TOKEN\n */\n '--password <value>'?: string\n\n /**\n * Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).\n * @environment SHOPIFY_FLAG_STORE\n */\n '-s, --store <value>'?: string\n\n /**\n * The password for storefronts with password protection.\n * @environment SHOPIFY_FLAG_STORE_PASSWORD\n */\n '--store-password <value>'?: string\n\n /**\n * Theme ID or name of the remote theme.\n * @environment SHOPIFY_FLAG_THEME_ID\n */\n '-t, --theme <value>'?: string\n\n /**\n * The url to be used as context\n * @environment SHOPIFY_FLAG_URL\n */\n '--url <value>'?: string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
"value": "export interface themeprofile {\n /**\n * Output the result as JSON.\n * @environment SHOPIFY_FLAG_JSON\n */\n '-j, --json'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Password generated from the Theme Access app.\n * @environment SHOPIFY_CLI_THEME_TOKEN\n */\n '--password <value>'?: string\n\n /**\n * Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).\n * @environment SHOPIFY_FLAG_STORE\n */\n '-s, --store <value>'?: string\n\n /**\n * The password for storefronts with password protection.\n * @environment SHOPIFY_FLAG_STORE_PASSWORD\n */\n '--store-password <value>'?: string\n\n /**\n * Theme ID or name of the remote theme.\n * @environment SHOPIFY_FLAG_THEME_ID\n */\n '-t, --theme <value>'?: string\n\n /**\n * The url to be used as context\n * @environment SHOPIFY_FLAG_URL\n */\n '--url <value>'?: string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,7 @@ USAGE
$ shopify theme profile --url /products/classic-leather-jacket
FLAGS
-j, --json Return profiling data as JSON.
-j, --json Output the result as JSON.
-s, --store=<value> Store URL. It can be the store prefix (example) or the full myshopify.com URL
(example.myshopify.com, https://example.myshopify.com).
-t, --theme=<value> Theme ID or name of the remote theme.
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/oclif.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5838,8 +5838,9 @@
"json": {
"allowNo": false,
"char": "j",
"description": "Return profiling data as JSON.",
"description": "Output the result as JSON.",
"env": "SHOPIFY_FLAG_JSON",
"hidden": false,
"name": "json",
"type": "boolean"
},
Expand Down
8 changes: 2 additions & 6 deletions packages/theme/src/cli/commands/theme/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {findOrSelectTheme} from '../../utilities/theme-selector.js'
import {renderTasksToStdErr} from '../../utilities/theme-ui.js'
import {ensureAuthenticatedThemes} from '@shopify/cli-kit/node/session'
import {Flags} from '@oclif/core'
import {globalFlags} from '@shopify/cli-kit/node/cli'
import {globalFlags, jsonFlag} from '@shopify/cli-kit/node/cli'
import {Task} from '@shopify/cli-kit/node/ui'

export default class Profile extends ThemeCommand {
Expand Down Expand Up @@ -38,11 +38,7 @@ export default class Profile extends ThemeCommand {
description: 'The password for storefronts with password protection.',
env: 'SHOPIFY_FLAG_STORE_PASSWORD',
}),
json: Flags.boolean({
char: 'j',
description: 'Return profiling data as JSON.',
env: 'SHOPIFY_FLAG_JSON',
}),
...jsonFlag,
}

async run(): Promise<void> {
Expand Down

0 comments on commit dbfa8b9

Please sign in to comment.