Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [Cli]provision to select resource group location need to press enter twice #11724

Merged
merged 4 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"@types/chai-as-promised": "^7.1.3",
"@types/express": "^4.17.14",
"@types/fs-extra": "^8.0.1",
"@types/inquirer": "7.3.3",
"@types/keytar": "^4.4.2",
"@types/lodash": "^4.14.170",
"@types/mocha": "^8.0.4",
Expand Down Expand Up @@ -114,7 +113,6 @@
"express": "^4.19.2",
"figures": "^3.2.0",
"fs-extra": "^9.1.0",
"inquirer": "^7.3.3",
"lodash": "^4.17.21",
"node-machine-id": "^1.1.12",
"open": "^8.2.1",
Expand Down
64 changes: 6 additions & 58 deletions packages/cli/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions packages/cli/src/colorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export enum TextType {
Important = "important",
Details = "details", // secondary text
Commands = "commands", // commands, parameters, system inputs
Spinner = "spinner",
}

export function colorize(message: string, type: TextType): string {
Expand All @@ -39,8 +38,6 @@ export function colorize(message: string, type: TextType): string {
return chalk.gray(message);
case TextType.Commands:
return chalk.blueBright(message);
case TextType.Spinner:
return chalk.yellowBright(message);
}
}

Expand Down
54 changes: 0 additions & 54 deletions packages/cli/src/spinner.ts

This file was deleted.

24 changes: 8 additions & 16 deletions packages/cli/src/userInteraction.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { confirm, password } from "@inquirer/prompts";
import { prompt } from "inquirer";
import { confirm, password, input } from "@inquirer/prompts";
import {
Colors,
ConfirmConfig,
Expand Down Expand Up @@ -46,7 +45,7 @@ import { cliSource } from "./constants";
import { CheckboxChoice, SelectChoice, checkbox, select } from "./prompts";
import { errors } from "./resource";
import { getColorizedString } from "./utils";
import { CustomizedSpinner } from "./spinner";

/// TODO: input can be undefined
type ValidationType<T> = (input: T) => string | boolean | Promise<string | boolean>;

Expand Down Expand Up @@ -114,17 +113,13 @@ class CLIUserInteraction implements UserInteraction {
return ok(defaultValue || "");
}
ScreenManager.pause();
const answer = await prompt([
{
type: "input",
name: name,
message: message,
default: defaultValue,
validate: validate,
},
]);
const answer = await input({
message,
default: defaultValue,
validate,
});
ScreenManager.continue();
return ok(answer[name]);
return ok(answer);
}

async password(
Expand Down Expand Up @@ -436,16 +431,13 @@ class CLIUserInteraction implements UserInteraction {
if (config.validation || config.additionalValidationOnAccept) {
validationFunc = async (input: string) => {
let res: string | undefined = undefined;
const spinner = new CustomizedSpinner();
spinner.start();
if (config.validation) {
res = await config.validation(input);
}

if (!res && !!config.additionalValidationOnAccept) {
res = await config.additionalValidationOnAccept(input);
}
spinner.stop();
return res;
};
}
Expand Down
3 changes: 0 additions & 3 deletions packages/cli/tests/unit/colorize.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ describe("colorize", () => {
it("colorize - Commands", async () => {
colorize("test", TextType.Commands);
});
it("colorize - Spinner", async () => {
colorize("test", TextType.Spinner);
});
it("replace template string", async () => {
const template = "test %s";
const result = replaceTemplateString(template, "test");
Expand Down
66 changes: 0 additions & 66 deletions packages/cli/tests/unit/spinner.tests.ts

This file was deleted.

Loading
Loading