本文整理匯總了TypeScript中vscode.Terminal.sendText方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Terminal.sendText方法的具體用法?TypeScript Terminal.sendText怎麽用?TypeScript Terminal.sendText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vscode.Terminal
的用法示例。
在下文中一共展示了Terminal.sendText方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: startTask
public async startTask(
executable: string,
preCommandArgs: string[],
command: string,
args: string[],
cwd: string
): Promise<void> {
args = preCommandArgs.concat(command, ...args);
const terminal = window.createTerminal('Cargo Task');
this._runningTerminal = terminal;
const shell = await this._shellProvider.getValue();
if (shell === undefined) {
return;
}
const setEnvironmentVariables = () => {
const cargoEnv = this._configuration.getCargoEnv();
// Set environment variables
for (const name in cargoEnv) {
if (name in cargoEnv) {
const value = cargoEnv[name];
terminal.sendText(getCommandToSetEnvVar(shell, name, value));
}
}
};
setEnvironmentVariables();
// Change the current directory to a specified directory
this._runningTerminal.sendText(getCommandToChangeWorkingDirectory(shell, cwd));
// Start a requested command
this._runningTerminal.sendText(getCommandForArgs(shell, [executable, ...args]));
this._runningTerminal.show(true);
}
示例2:
const runCommandInIntegratedTerminal = (args: string[], cwd: string) => {
if (terminal === null) {
terminal = window.createTerminal('sbt');
// start sbt
terminal.sendText('sbt', true);
}
terminal.show();
terminal.sendText(args.join(' '));
};
示例3: runCommandInIntegratedTerminal
function runCommandInIntegratedTerminal(args: string[], cwd: string): void {
const cmd_args = Array.from(args);
if (!terminal) {
terminal = window.createTerminal('npm');
}
terminal.show();
if (cwd) {
terminal.sendText(['cd', cwd].join(' '));
}
cmd_args.splice(0, 0, getNpmBin());
terminal.sendText(cmd_args.join(' '));
}
示例4: ensureTerminal
private ensureTerminal(cwd: string): Terminal {
if (this._terminal === undefined) {
this._terminal = window.createTerminal(extensionTerminalName);
this._disposable = window.onDidCloseTerminal((e: Terminal) => {
if (e.name === extensionTerminalName) {
this._terminal = undefined;
this._disposable!.dispose();
this._disposable = undefined;
}
}, this);
Container.context.subscriptions.push(this._disposable);
this._terminalCwd = undefined;
}
if (this._terminalCwd !== cwd) {
this._terminal.sendText(`cd "${cwd}"`, true);
this._terminalCwd = cwd;
}
return this._terminal;
}