vue-shell

Simulate a terminal shell components with Vue
3,657 46
Install
npm install vue-shell
Latest Version:1.0.3
Vue:2
License:MIT
Last Updated:Dec 13, 2022
Links: GitHub  ·  npm
Maintainer: halasproject

vue-shell

What is this ?

vue-shell is a component vuejs to provides an easy way to create a terminal on your application and then add your own philosophy by adding all the commands you want with their rendering in the output.

  • Navigate the history with key-up | key-down

  • Clean the current terminal with clear

  • Browse all your commands with help

Open in CodeSandBox

Installation

npm i vue-shell --save
import Vue from "vue";
import shell from 'vue-shell'
Vue.use(shell);
<template>
  <v-shell></v-shell>
</template>

Example

<template>
  <div>
    <v-shell
      :banner="banner"
      :shell_input="send_to_terminal"
      :commands="commands"
      @shell_output="prompt"
    ></v-shell>
  </div>
</template>

<script>
export default {
  data() {
    return {
      send_to_terminal: "",
      banner: {
        header: "Vue Shell",
        subHeader: "Shell is power just enjoy 🔥",
        helpHeader: 'Enter "help" for more information.',
        emoji: {
            first: "🔅",
            second: "🔆",
            time: 750
        },
        sign: "VueShell $",
        img: {
            align: "left",
            link: "/mylogo.png",
            width: 100,
            height: 100
        }
      },
      commands: [
        { name: "info",
          get() {
            return `<p>With ❤️ By Salah Bentayeb @halasproject.</p>`;
        }
        },
        {
          name: "uname",
          get() {
            return navigator.appVersion;
          }
        }
      ]
    };
  },
  methods: {
    prompt(value) {
      if (value == "node -v") {
        this.send_to_terminal = process.versions.node;
      }
    }
  }
};
</script>

<style>
</style>

API

Props Type Required
banner Object false
commands Array false
shell_input String false

Event Type Required
shell_output Any false
banner
{
  header: String,
	subHeader: String,
	helpHeader: String,
	sign: String,
	img: {
   		align: "left" | "right",
  		link: String,
    	width: Number,
    	height: Number },
	emoji: {
        first: "🔅",
        second: "🔆",
        time: Number (ms) }
}
commands
[
  { name: String,
    get() {
       return String | HTML;
    }
  }
]
output
<template>
	<v-shell @shell_output="prompt" :shell_input="send_to_terminal"></v-shell>
</template>

<script>
export default {
	data(){
    	return{
        	send_to_terminal:''
   		}
	},
  	methods:{
  		prompt(val){
  			if (val == "ifconfig"){
            	// Do somthing ... then send the data to shell
            	this.send_to_terminal = data
        	} else {
                // Else send error message in output of shell
				      this.send_to_terminal = `'${val}' is not recognized as an internal command or external, an executable program or a batch file`
        	}
  		}
  	}
}
</script>

Related Packages

vue-command

A fully working, most feature-rich Vue.js terminal emulator

82,254 394
vite-plugin-vue-termui

Vite Plugin for Vue TermUI

1,768 980
fman

旨在通过工具链提高本地开发效率。

1,003
vue-terminal

A terminal emulator in Vue

1,055 267
vtui-docs

Interactive docs terminal for vue-termui.

400 21

Version History

Version Released Vue License
1.0.3 ^2.6.11 MIT
1.0.2 ^2.6.11 MIT
1.0.1 ^2.6.11 MIT
1.0.0 ^2.6.11 MIT