# vue-command
A fully working Vue.js terminal emulator. See the [demo](https://ndabap.github.io/vue-command/).
## Features
- Parse arguments with [yargs-parser](https://www.npmjs.com/package/yargs-parser)
- Search history (with <kbd>↑</kbd>/<kbd>↓</kbd>)
- White/Dark theme support
- Autocomplete (with <kbd>↹</kbd>)
- Supports asynchronous commands
## Installation
```bash
$ npm i vue-command --save
```
## Properties
| Property | Type | Default | Required | Description |
|-----------------|-----------|--------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `commands` | `Object` | `{}` | Yes | Key-value pairs where key is command and value is function with [yargs arguments](https://github.com/yargs/yargs-parser#readme). Function should return either a `String` or a `Promise` that resolves to a `String` |
| `help-text` | `String` | `Type help` | No | Sets the placeholder |
| `help-timeout` | `Number` | `4000` | No | Sets the placeholder timeout |
| `hide-bar` | `Boolean` | `false` | No | Hides the bar |
| `hide-prompt` | `Boolean` | `false` | No | Hides the prompt |
| `intro` | `String` | `Fasten your seatbelts!` | No | Sets the intro |
| `prompt` | `String` | `~neil@moon:#` | No | Sets the prompt
| `keep-prompt` | `Boolean` | `false` | No | Keeps the prompt for already executed commands |
| `show-help` | `Boolean` | `false` | No | Shows the placeholder |
| `show-intro` | `Boolean` | `false` | No | Shows the intro |
| `title` | `String` | `neil@moon: ~` | No | Sets the title |
| `white-theme` | `Boolean` | `false` | No | Enables the white theme |
| `yargs-options` | `Object` | `{}` | No | Sets the [yargs options](https://github.com/yargs/yargs-parser#readme) |
## Events
| Event | Type | Description |
|-----------|-------------|-----------------------------------|
| `input` | `String` | Emits the current input |
| `execute` | `String` | Emits the whole executing command |
| `executed`| `String` | Emits after command execution |
## Usage
```vue
<template>
<vue-command
:yargs-options="{ alias: { color: ['colour'] } }"
:commands="commands"
/>
</template>
<script>
import VueCommand from 'vue-command'
import 'vue-command/dist/vue-command.css'
export default {
components: {
VueCommand
},
data: () => ({
commands: {
// yargs arguments
pokedex: ({ color, _ }) => {
if (color && _[1] === 'pikachu') return 'yellow'
return `Usage: pokedex pokemon [option]<br><br>
Example: pokedex pikachu --color
`
}
}
})
}
</script>
<style lang="scss">
.vue-command {
.term {
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
.term-std {
min-height: 300px;
max-height: 300px;
overflow-y: scroll;
}
}
</style>
```
## Author
[Julian Claus](https://www.julian-claus.de) and contributors.
## License
MIT
没有合适的资源?快使用搜索试试~ 我知道了~
vuecommand一个完全工作的Vuejs终端模拟器
共39个文件
js:14个
map:5个
vue:4个
需积分: 48 11 下载量 167 浏览量
2019-08-11
22:43:11
上传
评论
收藏 1.13MB ZIP 举报
温馨提示
vue-command:一个完全工作的Vue.js终端模拟器
资源推荐
资源详情
资源评论
收起资源包目录
vuecommand一个完全工作的Vuejs终端模拟器.zip (39个子文件)
vue-command-master
postcss.config.js 59B
public
index.html 529B
yarn.lock 429KB
.browserslistrc 33B
.eslintrc.js 550B
src
main.js 135B
Stdout.vue 345B
scss
mixins.scss 276B
constants.js 109B
App.vue 2KB
Stdin.vue 3KB
index.js 65B
VueCommand.vue 7KB
babel.config.js 53B
CONTRIBUTING.md 704B
.travis.yml 101B
LICENSE 1KB
jest.config.js 663B
README.md 6KB
dist
vue-command.umd.min.js 106KB
vue-command.common.js.map 429KB
vue-command.css 1KB
vue-command.umd.js.map 430KB
vue-command.umd.min.js.map 507KB
vue-command.common.js 354KB
vue-command.umd.js 355KB
demo.html 196B
vue.config.js 148B
docs
index.html 719B
js
app.43ff2fa1.js 10KB
chunk-vendors.ce0e14ce.js 164KB
chunk-vendors.ce0e14ce.js.map 808KB
app.43ff2fa1.js.map 53KB
css
app.326e3146.css 2KB
.editorconfig 121B
tests
unit
vue-command.spec.js 4KB
.gitignore 230B
package-lock.json 659KB
package.json 2KB
共 39 条
- 1
资源评论
weixin_39840914
- 粉丝: 435
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功