Skip to content

Commit 8c63d1a

Browse files
committed
Refactor metafields pull command to use ThemeCommand's run method
Previously `theme metafields pull` command implemented its own `run` logic. This commit refactors `metafields pull` to use ThemeCommand's base `run()` method. This will help to standardize command architecture and allow for out of the box authentication and environments support
1 parent e885a89 commit 8c63d1a

File tree

1 file changed

+7
-3
lines changed
  • packages/theme/src/cli/commands/theme/metafields

1 file changed

+7
-3
lines changed

packages/theme/src/cli/commands/theme/metafields/pull.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import {themeFlags} from '../../../flags.js'
22
import {metafieldsPull, MetafieldsPullFlags} from '../../../services/metafields-pull.js'
3-
import ThemeCommand from '../../../utilities/theme-command.js'
3+
import ThemeCommand, {RequiredFlags} from '../../../utilities/theme-command.js'
44
import {globalFlags} from '@shopify/cli-kit/node/cli'
55
import {Flags} from '@oclif/core'
6+
import {InferredFlags} from '@oclif/core/interfaces'
7+
8+
type MetafieldsFlags = InferredFlags<typeof MetafieldsPull.flags>
69

710
export default class MetafieldsPull extends ThemeCommand {
811
static summary = 'Download metafields definitions from your shop into a local file.'
@@ -24,8 +27,9 @@ If the metafields file already exists, it will be overwritten.`
2427
}),
2528
}
2629

27-
async run(): Promise<void> {
28-
const {flags} = await this.parse(MetafieldsPull)
30+
static multiEnvironmentsFlags: RequiredFlags = null
31+
32+
async command(flags: MetafieldsFlags) {
2933
const args: MetafieldsPullFlags = {
3034
path: flags.path,
3135
password: flags.password,

0 commit comments

Comments
 (0)