From 5d605a485352be619514faffd6daf4490017e165 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 20 May 2018 13:30:45 +0200 Subject: [PATCH] Cmder support (fixes #347) --- README.md | 4 +-- terminus-terminal/src/index.ts | 2 ++ terminus-terminal/src/shells/cmder.ts | 38 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 terminus-terminal/src/shells/cmder.ts diff --git a/README.md b/README.md index ae43fe03..3318d27f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ * Doesn't choke on fast-flowing outputs * Tab persistence on macOS and Linux * Proper shell-like experience on Windows including tab completion (thanks, Clink!) - * CMD, PowerShell, Cygwin, Git-Bash and Bash on Windows support + * CMD, PowerShell, PowerShell Core, Cygwin, Cmder, Git-Bash and WSL (Bash on Windows) support * Default Linux style hotkeys for copy (`Ctrl`+`Shift`+`C`) and paste (`Ctrl`+`Shift`+`V`) --- @@ -49,4 +49,4 @@ See [HACKING.md](https://github.com/Eugeny/terminus/blob/master/HACKING.md) for ## License -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FEugeny%2Fterminus.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FEugeny%2Fterminus?ref=badge_large) \ No newline at end of file +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FEugeny%2Fterminus.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FEugeny%2Fterminus?ref=badge_large) diff --git a/terminus-terminal/src/index.ts b/terminus-terminal/src/index.ts index dbb5cd11..796a0125 100644 --- a/terminus-terminal/src/index.ts +++ b/terminus-terminal/src/index.ts @@ -26,6 +26,7 @@ import { TerminalConfigProvider } from './config' import { TerminalHotkeyProvider } from './hotkeys' import { HyperColorSchemes } from './colorSchemes' +import { CmderShellProvider } from './shells/cmder' import { CustomShellProvider } from './shells/custom' import { Cygwin32ShellProvider } from './shells/cygwin32' import { Cygwin64ShellProvider } from './shells/cygwin64' @@ -61,6 +62,7 @@ import { hterm } from './hterm' { provide: SessionPersistenceProvider, useClass: ScreenPersistenceProvider, multi: true }, { provide: SessionPersistenceProvider, useClass: TMuxPersistenceProvider, multi: true }, + { provide: ShellProvider, useClass: CmderShellProvider, multi: true }, { provide: ShellProvider, useClass: WindowsStockShellsProvider, multi: true }, { provide: ShellProvider, useClass: MacOSDefaultShellProvider, multi: true }, { provide: ShellProvider, useClass: LinuxDefaultShellProvider, multi: true }, diff --git a/terminus-terminal/src/shells/cmder.ts b/terminus-terminal/src/shells/cmder.ts new file mode 100644 index 00000000..9a27dfd7 --- /dev/null +++ b/terminus-terminal/src/shells/cmder.ts @@ -0,0 +1,38 @@ +import * as path from 'path' +import { Injectable } from '@angular/core' +import { HostAppService, Platform } from 'terminus-core' + +import { ShellProvider, IShell } from '../api' + + +@Injectable() +export class CmderShellProvider extends ShellProvider { + constructor ( + private hostApp: HostAppService, + ) { + super() + } + + async provide (): Promise { + if (this.hostApp.platform !== Platform.Windows) { + return [] + } + + if (!process.env.CMDER_ROOT) { + return [] + } + + return [{ + id: 'cmder', + name: 'Cmder', + command: 'cmd.exe', + args: [ + '/k', + path.join(process.env.CMDER_ROOT, 'vendor', 'init.bat'), + ] + env: { + TERM: 'cygwin', + } + }] + } +}