vue-terminal-ui
Advanced tools
Comparing version 0.1.5 to 0.1.6
{ | ||
"name": "vue-terminal-ui", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "terminal UI for VueJs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,4 @@ # Vuejs terminal UI emulator | ||
[**Demo available here**](https://codepen.io/shershen08/pen/Keozqx) | ||
## Demo/sandbox available here: | ||
[![Edit Vue Template](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/4xxxkznk74) | ||
@@ -21,3 +22,13 @@ ## Install | ||
VueTerminal | ||
} | ||
}, | ||
// add method to call on command is typed | ||
methods: { | ||
onCliCommand(data, resolve, reject){ | ||
// typed command is available in data.text | ||
// don't forget to resolve or reject the Promise | ||
setTimeout(()=> { | ||
resolve('') | ||
}, 300) | ||
} | ||
}, | ||
// use in template | ||
@@ -50,2 +61,2 @@ <VueTerminal :intro="intro" | ||
MIT | ||
MIT |
@@ -560,6 +560,10 @@ import jQuery from 'jquery' | ||
if(settings.allowArbitrary) { | ||
return settings.passCommand(cmd_name).then(result => { | ||
add_to_history(cmd) | ||
return settings.passCommand(cmd_obj.last).then(result => { | ||
cmd_obj.out = result | ||
return cmd_update() | ||
}) | ||
}).catch(error => { | ||
cmd_obj.out = error | ||
return cmd_update() | ||
}) | ||
} else { | ||
@@ -736,5 +740,6 @@ | ||
var add_to_history = function(str) { | ||
if( typeof commands[cmd_name] !== 'undefined' | ||
&& str !== '' | ||
&& save_to_history > 0) { | ||
const isProper = typeof commands[cmd_name] !== 'undefined' | ||
&& str !== '' | ||
&& save_to_history > 0 | ||
if( isProper || options.allowArbitrary) { | ||
@@ -741,0 +746,0 @@ if( history.length > settings.history_entries ){ |
Sorry, the diff of this file is not supported yet
169041
843
60