1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-24 19:13:31 +03:00

Follow the general Terminus style

This commit is contained in:
Domain 2018-08-29 17:02:02 +08:00
parent ce2c72393b
commit 98a7801803
2 changed files with 11 additions and 22 deletions

View File

@ -30,27 +30,22 @@ export class SSHSession extends BaseSession {
let dataString = data.toString()
this.emitOutput(dataString)
if (this.scripts && this.scripts.length > 0)
{
if (this.scripts && this.scripts.length > 0) {
let found = false
for (let i = 0; i < this.scripts.length; i++)
{
if (dataString.indexOf(this.scripts[i].expect) >= 0)
{
for (let i = 0; i < this.scripts.length; i++) {
if (dataString.indexOf(this.scripts[i].expect) >= 0) {
console.log("Executing: " + this.scripts[i].send)
this.shell.write(this.scripts[i].send + "\n")
this.scripts.splice(i, 1)
i--
found = true
}
else
{
else {
break;
}
}
if (found)
{
if (found) {
this.executeScripts()
}
}
@ -66,19 +61,15 @@ export class SSHSession extends BaseSession {
}
executeScripts () {
if (this.scripts && this.scripts.length > 0)
{
for (let i = 0; i < this.scripts.length; i++)
{
if (!this.scripts[i].expect)
{
if (this.scripts && this.scripts.length > 0) {
for (let i = 0; i < this.scripts.length; i++) {
if (!this.scripts[i].expect) {
console.log("Executing: " + this.scripts[i].send)
this.shell.write(this.scripts[i].send + "\n")
this.scripts.splice(i, 1)
i--
}
else
{
else {
break;
}
}

View File

@ -40,8 +40,7 @@ export class EditConnectionModalComponent {
up (script: LoginScript) {
let index = this.connection.scripts.indexOf(script)
if (index > 0)
{
if (index > 0) {
this.connection.scripts.splice(index, 1);
this.connection.scripts.splice(index - 1, 0, script);
}
@ -49,8 +48,7 @@ export class EditConnectionModalComponent {
down (script: LoginScript) {
let index = this.connection.scripts.indexOf(script)
if (index >= 0 && index < this.connection.scripts.length - 1)
{
if (index >= 0 && index < this.connection.scripts.length - 1) {
this.connection.scripts.splice(index, 1);
this.connection.scripts.splice(index + 1, 0, script);
}