Skip to content
Open
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
11 changes: 8 additions & 3 deletions packages/databricks-vscode/src/bundle/BundleInitWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,16 @@ export class BundleInitWizard {
"--output-dir",
escapePathArgument(parentFolder.fsPath),
].join(" ");
const initialPrompt = `clear; echo "Executing: databricks ${args}\nFollow the steps below to create your new Databricks project.\n"`;
const finalPrompt = `echo "\nPress any key to close the terminal and continue ..."; ${ShellUtils.readCmd()}; exit`;
terminal.sendText(ShellUtils.clearCmd());
terminal.sendText(`echo Executing: databricks ${args}`);
terminal.sendText(
`${initialPrompt}; ${this.cli.escapedCliPath} ${args}; ${finalPrompt}`
"echo Follow the steps below to create your new Databricks project."
);
terminal.sendText(`${this.cli.escapedCliPath} ${args}`);
terminal.sendText("echo.");
terminal.sendText("echo Press any key to close the terminal and continue ...");
terminal.sendText(ShellUtils.readCmd());
terminal.sendText("exit");
return terminalDidClosePromise;
}

Expand Down
23 changes: 22 additions & 1 deletion packages/databricks-vscode/src/utils/shellUtils.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
import {env} from "vscode";

function shellPath() {
return env.shell.toLowerCase();
}

export function isPowershell() {
return env.shell.toLowerCase().includes("powershell");
return shellPath().includes("powershell");
}

export function isCmd() {
return shellPath().endsWith("cmd.exe") || shellPath().includes("\\cmd");
}

export function readCmd() {
if (isPowershell()) {
return "Read-Host";
}
if (isCmd()) {
return "pause";
}
return "read";
}

export function clearCmd() {
if (isPowershell()) {
return "Clear-Host";
}
if (isCmd()) {
return "cls";
}
return "clear";
}

export function escapeExecutableForTerminal(exe: string): string {
if (isPowershell()) {
return `& "${exe}"`;
Expand Down
Loading