diff --git a/Makefile b/Makefile index 1616ff7..2c601bc 100644 --- a/Makefile +++ b/Makefile @@ -75,7 +75,7 @@ test: if [ $$(go fmt $$(go list ./...) | wc -l) -gt 0 ]; then echo "go fmt error"; exit 1; fi cd js && npx tsfmt -r --verify -.PHONY: fmt +.PHONY: tsfmt tsfmt: cd js && npx tsfmt -r diff --git a/js/dist/main.d.ts b/js/dist/main.d.ts index cb0ff5c..2234b9c 100644 --- a/js/dist/main.d.ts +++ b/js/dist/main.d.ts @@ -1 +1 @@ -export {}; +export { }; diff --git a/js/src/hterm.ts b/js/src/hterm.ts index 0bdec30..cc68f51 100644 --- a/js/src/hterm.ts +++ b/js/src/hterm.ts @@ -52,11 +52,11 @@ export class Hterm { }; setPreferences(value: object) { - Object.keys(value).forEach((key) => { - if (key != "enable-webgl") { - this.term.getPrefs().set(key, value[key]); - } - }); + Object.keys(value).forEach((key) => { + if (key != "enable-webgl") { + this.term.getPrefs().set(key, value[key]); + } + }); }; onInput(callback: (input: string) => void) { @@ -77,9 +77,9 @@ export class Hterm { }; deactivate(): void { - this.io.onVTKeystroke = function(){}; - this.io.sendString = function(){}; - this.io.onTerminalResize = function(){}; + this.io.onVTKeystroke = function() { }; + this.io.sendString = function() { }; + this.io.onTerminalResize = function() { }; this.term.uninstallKeyboard(); } diff --git a/js/src/xterm.ts b/js/src/xterm.ts index 9158994..60527f6 100644 --- a/js/src/xterm.ts +++ b/js/src/xterm.ts @@ -1,9 +1,8 @@ -import {lib} from "libapps"; - -import {IDisposable, Terminal} from 'xterm'; -import {FitAddon} from "xterm-addon-fit"; -import {WebglAddon} from "xterm-addon-webgl"; +import { lib } from "libapps"; +import { IDisposable, Terminal } from "xterm"; +import { FitAddon } from "xterm-addon-fit"; +import { WebglAddon } from "xterm-addon-webgl"; export class Xterm { elem: HTMLElement; @@ -15,13 +14,13 @@ export class Xterm { messageTimeout: number; messageTimer: NodeJS.Timer; - fitAddon: FitAddon; - disposables: IDisposable[] = []; + fitAddon: FitAddon; + disposables: IDisposable[] = []; constructor(elem: HTMLElement) { this.elem = elem; - const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0; + const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0; this.term = new Terminal({ cursorStyle: "block", cursorBlink: true, @@ -30,20 +29,20 @@ export class Xterm { fontSize: 12, }); - this.fitAddon = new FitAddon(); - this.term.loadAddon(this.fitAddon); + this.fitAddon = new FitAddon(); + this.term.loadAddon(this.fitAddon); this.message = elem.ownerDocument.createElement("div"); this.message.className = "xterm-overlay"; this.messageTimeout = 2000; this.resizeListener = () => { - this.fitAddon.fit(); + this.fitAddon.fit(); this.term.scrollToBottom(); this.showMessage(String(this.term.cols) + "x" + String(this.term.rows), this.messageTimeout); }; - this.term.open(elem); + this.term.open(elem); this.term.focus() this.resizeListener(); @@ -85,28 +84,28 @@ export class Xterm { }; setPreferences(value: object) { - Object.keys(value).forEach((key) => { - if (key && key == "enable-webgl") { - this.term.loadAddon(new WebglAddon()); - } - }); + Object.keys(value).forEach((key) => { + if (key && key == "enable-webgl") { + this.term.loadAddon(new WebglAddon()); + } + }); }; onInput(callback: (input: string) => void) { - this.disposables.push(this.term.onData((data) => { - callback(data); - })); + this.disposables.push(this.term.onData((data) => { + callback(data); + })); }; onResize(callback: (colmuns: number, rows: number) => void) { - this.disposables.push(this.term.onResize((data) => { - callback(data.cols, data.rows); - })); + this.disposables.push(this.term.onResize((data) => { + callback(data.cols, data.rows); + })); }; deactivate(): void { - this.disposables.forEach(d => d.dispose()) + this.disposables.forEach(d => d.dispose()) this.term.blur(); } @@ -117,6 +116,6 @@ export class Xterm { close(): void { window.removeEventListener("resize", this.resizeListener); - this.term.dispose(); + this.term.dispose(); } } diff --git a/js/tsconfig.json b/js/tsconfig.json index 58346f0..18ea6a2 100644 --- a/js/tsconfig.json +++ b/js/tsconfig.json @@ -1,20 +1,21 @@ { "compilerOptions": { - "strictNullChecks": true, - "noUnusedLocals" : true, - "noImplicitThis": true, - "alwaysStrict": true, - "outDir": "./dist/", - "declaration": true, - "sourceMap": true, - "target": "es5", - "module": "commonJS", - "baseUrl": ".", - "paths": { - "*": ["./typings/*"] - } + "newLine": "LF", + "strictNullChecks": true, + "noUnusedLocals" : true, + "noImplicitThis": true, + "alwaysStrict": true, + "outDir": "./dist/", + "declaration": true, + "sourceMap": true, + "target": "es5", + "module": "commonJS", + "baseUrl": ".", + "paths": { + "*": ["./typings/*"] + } }, - "exclude": [ - "node_modules" + "exclude": [ + "node_modules" ] } diff --git a/js/typings/libapps/index.d.ts b/js/typings/libapps/index.d.ts index 81eb66d..d0d6c8f 100644 --- a/js/typings/libapps/index.d.ts +++ b/js/typings/libapps/index.d.ts @@ -37,7 +37,7 @@ export declare namespace lib { } export interface Memory { - new (): Storage; + new(): Storage; Memory(): Storage } diff --git a/utils/flags.go b/utils/flags.go index 36b4cd7..4b7b305 100644 --- a/utils/flags.go +++ b/utils/flags.go @@ -7,8 +7,8 @@ import ( "reflect" "strings" - "github.com/urfave/cli" "github.com/fatih/structs" + "github.com/urfave/cli" "github.com/yudai/hcl" "github.com/ghthor/gotty/v2/pkg/homedir"