Skip to content

Commit

Permalink
Added 'Open Karaf console' feature (#59)
Browse files Browse the repository at this point in the history
Signed-off-by: Kuba Wolanin <hi@kubawolanin.com>
  • Loading branch information
kubawolanin authored Nov 19, 2017
1 parent 08d2a55 commit ab67a3c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"activationEvents": [
"onCommand:openhab.searchDocs",
"onCommand:openhab.searchCommunity",
"onCommand:openhab.openKaraf",
"onCommand:openhab.basicUI",
"onCommand:openhab.command.refreshEntry",
"onCommand:openhab.command.showInPaperUI",
Expand Down Expand Up @@ -120,6 +121,10 @@
"command": "openhab.searchCommunity",
"title": "openHAB: Search in Community Forum"
},
{
"command": "openhab.openKaraf",
"title": "openHAB: Open Karaf console"
},
{
"command": "openhab.command.showInPaperUI",
"title": "Show in Paper UI"
Expand Down Expand Up @@ -236,6 +241,13 @@
"default": "paperui",
"description": "(optional) If you're using openHAB2 build from before 9th Jan 2017, change this parameter to 'ui'"
},
"openhab.karafCommand": {
"type": [
"string"
],
"default": "ssh openhab@%openhabhost% -p 8101",
"description": "Directly log into openHAB Karaf console. Note that this option is available only if you exposed Karaf console."
},
"openhab.sitemapPreviewUI": {
"type": [
"string"
Expand Down
8 changes: 7 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,16 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
openBrowser(`https://community.openhab.org/search?q=${query}`)
}))

disposables.push(commands.registerCommand('openhab.openKaraf', () => {
let command = config.karafCommand.replace(/%openhabhost%/g, config.host)
const terminal = window.createTerminal('openHAB')
terminal.sendText(command, true)
terminal.show(false)
}))

disposables.push(commands.registerCommand('openhab.command.showInPaperUI', (query?) => {
let param: string = query.name ? query.name : query
let title = `${param} - Paper UI`
let config = workspace.getConfiguration('openhab')
let paperPath = config.paperPath
let route = `/${paperPath}/index.html%23/configuration/`

Expand Down

0 comments on commit ab67a3c

Please sign in to comment.