From f24e7e5fed47da3ced6194ed525696a6a16b457e Mon Sep 17 00:00:00 2001 From: Radoslaw Krzemien Date: Fri, 1 Dec 2023 11:27:13 +0100 Subject: [PATCH] [eas-cli] Fix args Fixed args in `branch` commands See: https://linear.app/expo/issue/ENG-9175/update-oclif-in-eas-cli --- packages/eas-cli/src/commands/branch/create.ts | 12 ++++++------ packages/eas-cli/src/commands/branch/delete.ts | 9 +++++---- packages/eas-cli/src/commands/branch/view.ts | 10 ++++++---- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/packages/eas-cli/src/commands/branch/create.ts b/packages/eas-cli/src/commands/branch/create.ts index 4731c657bd..406355a532 100644 --- a/packages/eas-cli/src/commands/branch/create.ts +++ b/packages/eas-cli/src/commands/branch/create.ts @@ -1,3 +1,4 @@ +import { Args } from '@oclif/core'; import chalk from 'chalk'; import { createUpdateBranchOnAppAsync } from '../../branch/queries'; @@ -12,13 +13,12 @@ import { enableJsonOutput, printJsonOnlyOutput } from '../../utils/json'; export default class BranchCreate extends EasCommand { static override description = 'create a branch'; - static override args = [ - { - name: 'name', + static override args = { + name: Args.string({ required: false, description: 'Name of the branch to create', - }, - ]; + }), + }; static override flags = { ...EasNonInteractiveAndJsonFlags, @@ -49,7 +49,7 @@ export default class BranchCreate extends EasCommand { const projectDisplayName = await getDisplayNameForProjectIdAsync(graphqlClient, projectId); - if (!name) { + while (!name) { const validationMessage = 'Branch name may not be empty.'; if (nonInteractive) { throw new Error(validationMessage); diff --git a/packages/eas-cli/src/commands/branch/delete.ts b/packages/eas-cli/src/commands/branch/delete.ts index 660f381d2c..02c62fc0af 100644 --- a/packages/eas-cli/src/commands/branch/delete.ts +++ b/packages/eas-cli/src/commands/branch/delete.ts @@ -1,3 +1,4 @@ +import { Args } from '@oclif/core'; import chalk from 'chalk'; import gql from 'graphql-tag'; @@ -83,13 +84,13 @@ export default class BranchDelete extends EasCommand { ...this.ContextOptions.LoggedIn, }; - static override args = [ - { + static override args = { + name: Args.string({ name: 'name', required: false, description: 'Name of the branch to delete', - }, - ]; + }), + }; static override flags = { ...EasNonInteractiveAndJsonFlags, diff --git a/packages/eas-cli/src/commands/branch/view.ts b/packages/eas-cli/src/commands/branch/view.ts index 71cd4d43c2..8a32a7639f 100644 --- a/packages/eas-cli/src/commands/branch/view.ts +++ b/packages/eas-cli/src/commands/branch/view.ts @@ -1,3 +1,5 @@ +import { Args } from '@oclif/core'; + import { selectBranchOnAppAsync } from '../../branch/queries'; import EasCommand from '../../commandUtils/EasCommand'; import { EasNonInteractiveAndJsonFlags } from '../../commandUtils/flags'; @@ -12,13 +14,13 @@ import { enableJsonOutput } from '../../utils/json'; export default class BranchView extends EasCommand { static override description = 'view a branch'; - static override args = [ - { + static override args = { + name: Args.string({ name: 'name', required: false, description: 'Name of the branch to view', - }, - ]; + }), + }; static override flags = { ...EasPaginatedQueryFlags,