11import { appFlags } from '../../../flags.js'
22import { checkFolderIsValidApp } from '../../../models/app/loader.js'
3- import { linkedAppContext } from '../../../services/app-context.js'
3+ import { localAppContext } from '../../../services/app-context.js'
44import use from '../../../services/app/config/use.js'
5- import AppLinkedCommand , { AppLinkedCommandOutput } from '../../../utilities/app-linked -command.js'
5+ import AppUnlinkedCommand , { AppUnlinkedCommandOutput } from '../../../utilities/app-unlinked -command.js'
66import { Args } from '@oclif/core'
77import { globalFlags } from '@shopify/cli-kit/node/cli'
88
99// This is one of the few commands where we don't need a
1010// `--config` flag, because we're passing it as an argument.
1111const { config, ...appFlagsWithoutConfig } = appFlags
1212
13- export default class ConfigUse extends AppLinkedCommand {
13+ export default class ConfigUse extends AppUnlinkedCommand {
1414 static summary = 'Activate an app configuration.'
1515
1616 static descriptionWithMarkdown = `Sets default configuration when you run app-related CLI commands. If you omit the \`config-name\` parameter, then you'll be prompted to choose from the configuration files in your project.`
@@ -32,19 +32,17 @@ export default class ConfigUse extends AppLinkedCommand {
3232 } ) ,
3333 }
3434
35- public async run ( ) : Promise < AppLinkedCommandOutput > {
35+ public async run ( ) : Promise < AppUnlinkedCommandOutput > {
3636 const { flags, args} = await this . parse ( ConfigUse )
3737
38- await checkFolderIsValidApp ( flags . path )
39- await use ( { directory : flags . path , configName : args . config , reset : flags . reset } )
40-
41- const { app} = await linkedAppContext ( {
38+ const app = await localAppContext ( {
4239 directory : flags . path ,
43- clientId : undefined ,
44- forceRelink : false ,
4540 userProvidedConfigName : args . config ,
4641 } )
4742
43+ await checkFolderIsValidApp ( flags . path )
44+ await use ( { directory : flags . path , configName : args . config , reset : flags . reset } )
45+
4846 return { app}
4947 }
5048}
0 commit comments