# happner-terminal

> Terminal for happner (comes bundled)

Latest version **0.0.9** (published 2020-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install happner-terminal
pnpm add happner-terminal
yarn add happner-terminal
bun add happner-terminal
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2020-04-29 |
| First published | 2015-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 31.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | nomilous, smc-tenacious |

## Links

- npm: https://www.npmjs.com/package/happner-terminal
- Repository: https://github.com/happner/happner-terminal
- Homepage: https://github.com/happner/happner-terminal#readme
- Issues: https://github.com/happner/happner-terminal/issues
- npm.io page: https://npm.io/package/happner-terminal

## Dependencies (7)

- [async](https://npm.io/package/async.md) ^3.2.0
- [emdee](https://npm.io/package/emdee.md) 0.0.3
- [colors](https://npm.io/package/colors.md) ^1.1.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^1.0.0
- [keypress](https://npm.io/package/keypress.md) ^0.2.1
- [wordwrap](https://npm.io/package/wordwrap.md) ^1.0.0
- [repl.history](https://npm.io/package/repl.history.md) ^0.1.3

## Recent versions

- 0.0.9 (latest) — 2020-04-29
- 0.0.8 — 2016-11-04
- 0.0.7 — 2015-12-06
- 0.0.6 — 2015-09-28
- 0.0.5 — 2015-09-18
- 0.0.4 — 2015-09-08
- 0.0.3 — 2015-09-08
- 0.0.2 — 2015-09-07
- 0.0.1 — 2015-09-07

## README

# happner-terminal

Terminal for happner (comes bundled).

Provides a prompt into your running mesh.

Not a remote prompt.

#### To activate

##### in the config:

```javascript
meshConfig = {
  ...
  components: {
    terminal: {},
    ...
    ...
  }   
  ...
}
```

##### in the mesh initialization:

```javascript

// start your meshnode
                                                 // good practice...
var happner = require('happner');               //
happner.start( require('./your/meshConfig.js').config )

.then(function(mesh) {

  // meshnode is up, start the terminal

  mesh.exchange.terminal.start({
    prefix: '> ',  // the prompt
    help: true    // show the intro help
  }, function optionalCallback() {}) // or .then... (promise)

})

.catch...

```


__Note__: By putting the terminal component first, other components running their startMethods can detect and use the terminal. eg. To install commands into it.


#### Typical startMethod installing a command into the terminal

This in some other mesh component:

```javascript
Module.prototype.start = function($happn, callback) {

  var terminal;

  if (terminal = $happn.exchange.terminal) {

    // terminal is present.

    terminal.register('hello', {
    
      // creates a 'hello' command available in the terminal

      description: 'example',

      help: '\n\n\n',

      run: function(args, callback) {

        // if you don't call the callback you dont het the prompt back, ever!
        // (and you'll need to kill the process from the outside)

        callback(null, '\nHello ' + args[0] + '.\n');
      },

      autoComplete(args, callback) {
        var possible = ['world', 
                        'solarsystem',
                        'galaxy',
                        'universe']; // use args to determine next possibilities
        callback(null, possible);
      }

    });

  }

  callback(null);

}
```


#### Some useful $ things available in terminal.

---
_Source: https://npm.io/package/happner-terminal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
