-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Nightmarlin/master
Add inference of clearCommand and separator
- Loading branch information
Showing
7 changed files
with
118 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const Path = require('path') | ||
|
||
const KNOWN_SHELLS = { | ||
powershell: { separator: '; ', clearCommand: 'Clear-Host' }, | ||
node: { separator: '; ', clearCommand: 'console.clear();' }, | ||
cmd: { separator: ' & ', clearCommand: 'cls' }, | ||
fallback: { separator: ' && ', clearCommand: 'printf "\\033[H"' }, | ||
} | ||
|
||
exports.getSeparator = (browserWindow, uid) => { | ||
let shellName = Path.parse(browserWindow.sessions.get(uid).shell).name.toLowerCase() | ||
return KNOWN_SHELLS[shellName].separator || KNOWN_SHELLS['fallback'].separator // Separator not found | ||
} | ||
|
||
exports.getClearCommand = (browserWindow, uid) => { | ||
let shellName = Path.parse(browserWindow.sessions.get(uid).shell).name.toLowerCase() | ||
return KNOWN_SHELLS[shellName].clearCommand || KNOWN_SHELLS['fallback'].clearCommand // Command not found | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
exports.joinCommands = commands => commands.join(' && ') | ||
exports.joinCommands = (commands, commandSeparator = ' && ') => commands.join(commandSeparator) |