mirror of
https://github.com/wavetermdev/inshellisense.git
synced 2026-08-05 13:43:30 -07:00
feat: add parent-term-exit option to help close parent terminal
* Update inshellisense commands and options * fix: PR suggestions
This commit is contained in:
@@ -22,11 +22,12 @@ After completing the installation, you can run `is` to start the autocomplete se
|
||||
|
||||
### Usage
|
||||
|
||||
| Action | Command |
|
||||
| ------------------------------------- | ------- |
|
||||
| Start | `is` |
|
||||
| Stop | `exit` |
|
||||
| Check If Inside Inshellisense Session | `is -c` |
|
||||
| Action | Command | Description |
|
||||
| ------------------------------------- | --------------------------------- | ------------------------------------------------ |
|
||||
| Start | `is` | Start inshellisense session on the current shell |
|
||||
| Stop | `exit` | Stop inshellisense session on the current shell |
|
||||
| Check If Inside Inshellisense Session | `is -c` | Check if shell inside inshellisense session |
|
||||
|
||||
|
||||
#### Keybindings
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ type RootCommandOptions = {
|
||||
verbose: boolean | undefined;
|
||||
check: boolean | undefined;
|
||||
test: boolean | undefined;
|
||||
parentTermExit: boolean | undefined;
|
||||
};
|
||||
|
||||
export const action = (program: Command) => async (options: RootCommandOptions) => {
|
||||
@@ -40,5 +41,5 @@ export const action = (program: Command) => async (options: RootCommandOptions)
|
||||
} else if (shell == Shell.Bash) {
|
||||
await setupBashPreExec();
|
||||
}
|
||||
await render(shell, options.test ?? false);
|
||||
await render(shell, options.test ?? false, options.parentTermExit ?? false);
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@ program
|
||||
.action(action(program))
|
||||
.option("-s, --shell <shell>", `shell to use for command execution, supported shells: ${supportedShells}`)
|
||||
.option("-c, --check", `check if shell is in an inshellisense session`)
|
||||
.option("--parent-term-exit", `when inshellisense is closed, kill the parent process`)
|
||||
.addOption(hiddenOption("-T, --test", "used to make e2e tests reproducible across machines"))
|
||||
.option("-V, --verbose", `enable verbose logging`)
|
||||
.showHelpAfterError("(add --help for additional information)");
|
||||
|
||||
+4
-1
@@ -16,7 +16,7 @@ export const renderConfirmation = (live: boolean): string => {
|
||||
return `inshellisense session [${statusMessage}]\n`;
|
||||
};
|
||||
|
||||
export const render = async (shell: Shell, underTest: boolean) => {
|
||||
export const render = async (shell: Shell, underTest: boolean, parentTermExit: boolean) => {
|
||||
const term = await isterm.spawn({ shell, rows: process.stdout.rows, cols: process.stdout.columns, underTest });
|
||||
const suggestionManager = new SuggestionManager(term, shell);
|
||||
let hasActiveSuggestions = false;
|
||||
@@ -140,6 +140,9 @@ export const render = async (shell: Shell, underTest: boolean) => {
|
||||
});
|
||||
|
||||
term.onExit(({ exitCode }) => {
|
||||
if (parentTermExit && process.ppid) {
|
||||
process.kill(process.ppid);
|
||||
}
|
||||
process.exit(exitCode);
|
||||
});
|
||||
process.stdout.on("resize", () => {
|
||||
|
||||
Reference in New Issue
Block a user