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

Add cd and command args to create terminal command #7605

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/terminal-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,23 @@ export function addCommands(
term.title.icon = TERMINAL_ICON_CLASS;
term.title.label = '...';

const folder = args['cd'] as string;
const command = args['command'] as string;
let execute: string = '';
if (command) {
execute += `${command}\n`;
}
if (folder) {
execute += `cd ${folder}\n`;
}

if (execute) {
session.send({
type: 'stdin',
content: [execute]
});
}

let main = new MainAreaWidget({ content: term });
app.shell.add(main);
void tracker.add(main);
Expand Down