Added the 'cd' command, and improved the view a bit.
このコミットが含まれているのは:
コミット
73b2bf987c
|
@ -2,7 +2,7 @@
|
|||
/public/hot
|
||||
/public/js
|
||||
/public/css
|
||||
/public/storage/*
|
||||
/public/storage
|
||||
/public/assets
|
||||
/storage/*.key
|
||||
/vendor
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<template>
|
||||
<div>
|
||||
<span v-for="(l, i) in line" :key="`l-${i}`">
|
||||
<span class="regText">
|
||||
<span class="regText">
|
||||
<span v-for="(l, i) in line" :key="`l-${i}`">
|
||||
<span class="regBold">
|
||||
{{ l.username }}@{{ l.hostname }}:<span class="pathText">{{ l.path }}</span>
|
||||
</span>$
|
||||
<span v-if="l.active">
|
||||
<input
|
||||
:key="i"
|
||||
autofocus
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
class="inputField"
|
||||
|
@ -26,57 +27,60 @@
|
|||
@keyup.enter="exec(l.command, i)"
|
||||
/>
|
||||
</span>
|
||||
<span v-for="(res, d) in result" :key="`res-${d}`">
|
||||
<br />
|
||||
{{ res.text }}
|
||||
<span v-if="res.field">
|
||||
<span v-if="res.password">
|
||||
<span v-if="res.active">
|
||||
<input
|
||||
:key="i"
|
||||
password="password"
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
class="inputField"
|
||||
v-model="res.command"
|
||||
@keyup.enter="execContinue(res.command, i)"
|
||||
/>
|
||||
</span>
|
||||
<span v-else>
|
||||
<input
|
||||
:key="i"
|
||||
password="password"
|
||||
disabled
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
class="inputField"
|
||||
v-model="res.command"
|
||||
@keyup.enter="execContinue(res.command, i)"
|
||||
/>
|
||||
</span>
|
||||
<br />
|
||||
</span>
|
||||
<span v-for="(res, d) in result" :key="`res-${d}`">
|
||||
<br />
|
||||
{{ res.text }}
|
||||
<span v-if="res.field">
|
||||
<span v-if="res.password">
|
||||
<span v-if="res.active">
|
||||
<input
|
||||
:key="d"
|
||||
password="password"
|
||||
autofocus
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
class="inputField"
|
||||
v-model="res.command"
|
||||
@keyup.enter="execContinue(res.command, d)"
|
||||
/>
|
||||
</span>
|
||||
<span v-else>
|
||||
<span v-if="res.active">
|
||||
<input
|
||||
:key="i"
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
class="inputField"
|
||||
v-model="res.command"
|
||||
@keyup.enter="execContinue(res.command, i)"
|
||||
/>
|
||||
</span>
|
||||
<span v-else>
|
||||
<input
|
||||
:key="i"
|
||||
disabled
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
class="inputField"
|
||||
v-model="res.command"
|
||||
@keyup.enter="execContinue(res.command, i)"
|
||||
/>
|
||||
</span>
|
||||
<input
|
||||
:key="d"
|
||||
password="password"
|
||||
disabled
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
class="inputField"
|
||||
v-model="res.command"
|
||||
@keyup.enter="execContinue(res.command, d)"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
<span v-else>
|
||||
<span v-if="res.active">
|
||||
<input
|
||||
:key="d"
|
||||
spellcheck="false"
|
||||
autofocus
|
||||
type="text"
|
||||
class="inputField"
|
||||
v-model="res.command"
|
||||
@keyup.enter="execContinue(res.command, d)"
|
||||
/>
|
||||
</span>
|
||||
<span v-else>
|
||||
<input
|
||||
:key="d"
|
||||
disabled
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
class="inputField"
|
||||
v-model="res.command"
|
||||
@keyup.enter="execContinue(res.command, d)"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
<br />
|
||||
|
@ -136,13 +140,18 @@ export default {
|
|||
var arg = text.split(' ');
|
||||
|
||||
if (arg[0] === 'ls') this.ls(this.line[key].path);
|
||||
else if (arg[0] === 'cd') this.cd(arg[1]);
|
||||
else if (arg[0] === 'clear') this.clear();
|
||||
else this.result.push({
|
||||
active: true,
|
||||
text: arg[0] + ': コマンドは見つかれません。',
|
||||
field: false,
|
||||
password: false,
|
||||
command: ''
|
||||
})
|
||||
});
|
||||
|
||||
console.log('Line', this.line);
|
||||
console.log('Res', this.result);
|
||||
|
||||
this.line.push({
|
||||
active: true,
|
||||
|
@ -164,6 +173,22 @@ export default {
|
|||
command: ''
|
||||
})
|
||||
})
|
||||
},
|
||||
cd(pwd) {
|
||||
if (pwd === '/fuck' || pwd === 'fuck') this.result.push({
|
||||
active: true,
|
||||
text: 'bash: cd: ' + pwd + ': このファイルまたはフォルダがありません。',
|
||||
field: false,
|
||||
password: false,
|
||||
command: ''
|
||||
});
|
||||
if (!pwd.startsWith('/')) pwd = '/' + pwd;
|
||||
|
||||
this.pwd = pwd;
|
||||
},
|
||||
clear() {
|
||||
this.line = [];
|
||||
this.result = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
新しいイシューから参照