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

[tsp-client] Add no-prompt flag #8296

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions tools/tsp-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release

## 2024-05-20 - 0.7.1

- Added `--no-prompt` flag to skip the output directory confirmation prompt.

## 2024-04-18 - 0.7.0

- Remove `resources.json` after converting resource manager specifications.
Expand Down
4 changes: 2 additions & 2 deletions tools/tsp-client/package-lock.json

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

2 changes: 1 addition & 1 deletion tools/tsp-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure-tools/typespec-client-generator-cli",
"version": "0.7.0",
"version": "0.7.1",
"description": "A tool to generate Azure SDKs from TypeSpec",
"main": "dist/index.js",
"homepage": "https://github.com/Azure/azure-sdk-tools/tree/main/tools/tsp-client#readme",
Expand Down
11 changes: 9 additions & 2 deletions tools/tsp-client/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export async function getOptions(): Promise<Options> {
["local-spec-repo"]: {
type: "string",
},
["no-prompt"]: {
type: "boolean",
},
["save-inputs"]: {
type: "boolean",
},
Expand All @@ -72,7 +75,7 @@ export async function getOptions(): Promise<Options> {
},
arm: {
type: "boolean",
}
},
},
});
if (values.help) {
Expand Down Expand Up @@ -142,8 +145,12 @@ export async function getOptions(): Promise<Options> {
}
outputDir = resolvePath(process.cwd(), outputDir);

let noPrompt = false;
if (values["no-prompt"]) {
noPrompt = true;
}
let useOutputDir;
if (process.stdin.isTTY) {
if (process.stdin.isTTY && !noPrompt) {
// Ask user is this is the correct output directory
const prompt = PromptSync();
useOutputDir = prompt("Use output directory '" + outputDir + "'? (y/n) ", "y");
Expand Down