0.2.0 • Published 4 years ago

@henry781/ngx-terminal v0.2.0

Weekly downloads
6
License
ISC
Repository
github
Last release
4 years ago

NGX Terminal

This component is a basic easy to use fake terminal for Angular.

npm.io

Usage

component.html

<ngx-terminal [login]="login" [server]="server" (command)="onCommand($event)"></ngx-terminal>

component.ts

  public server = 'localhost';
  public login = 'henry781';

  onCommand(prompt: TerminalPrompt) {
    switch (prompt.getCommand()) {

      case 'whoami':
        prompt.response = prompt.login;
        prompt.responseComplete();
        break;

      default:
        prompt.response = 'unknown command';
        prompt.responseComplete();
    }
  }

module.ts

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    TerminalModule,
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {
}

Features

Autoscroll

This terminal supports autoscroll when the scroll position is at the end of the page. It can be disabled using the input autoscroll="false".

History (Up & Down)

Keyboard keys and allows to navigate in the command history.

Ansi color

There is a peer dependency with lib ansi_up.

Asynchronous response

HTML response

0.2.0

4 years ago

0.1.1

5 years ago

0.1.0

5 years ago