Skip to content

Commit

Permalink
(docs) add echo command
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Sep 19, 2024
1 parent 02d7ba0 commit abc5e3b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
5 changes: 5 additions & 0 deletions docs/src/components/Terminal/echo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { JQueryTerminal } from 'jquery.terminal';

export default function echo(this: JQueryTerminal, ...args: string[]) {
this.echo(args.join(' '));
};
30 changes: 16 additions & 14 deletions docs/src/components/Terminal/terminal.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
import type { JQueryTerminal } from 'jquery.terminal';

import github from './github';

function scroll() {
const { length } = this.get_output().split('\n');
const rows = this.rows();
if (rows >= length) {
this.removeClass('shake');
this.addClass('shake');
this.stopTime('shake');
this.oneTime(200, 'shake', () => {
this.removeClass('shake');
});
}
}
import echo from './echo';

export function initTerminal() {
const $ = (globalThis as any).$;
Expand All @@ -25,7 +13,8 @@ export function initTerminal() {
};

const term = $term.terminal({
github
github,
echo
}, {
processArguments: false,
checkArity: false,
Expand All @@ -42,3 +31,16 @@ export function destroyTerminal() {
const $term = $('.term');
$term.terminal().destroy();
}

function scroll() {
const { length } = this.get_output().split('\n');
const rows = this.rows();
if (rows >= length) {
this.removeClass('shake');
this.addClass('shake');
this.stopTime('shake');
this.oneTime(200, 'shake', () => {
this.removeClass('shake');
});
}
}

0 comments on commit abc5e3b

Please sign in to comment.