Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

accountdown-command

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accountdown-command

manage accountdown accounts from the command-line

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

accountdown-command

manage accountdown accounts from the command-line

This is particularly useful in combination with level-party so you can manage users while a server is running.

example

var accountdown = require('accountdown');
var command = require('accountdown-command');
var db = require('level-party')('./accounts.db');

var users = accountdown(db, {
    login: { basic: require('accountdown-basic') }
});

var args = process.argv.slice(2);
if (args[0] === 'users') {
    command(users, process.argv.slice(3), function (err) {
        if (err) {
            console.error(err + '');
            process.exit(1);
        }
        db.close();
    }).pipe(process.stdout);
}
else if (args[0] === 'server') {
    require('./lib/server.js')(users).listen(5000);
}

Now we can run a web server in the background:

$ ./cmd.js server &
[1] 12017

and add a user from the command-line:

$ ./cmd.js users create 1337 \
  --login.basic.username=substack --login.basic.password=yo \
  --value.name=substack

Now we can list users by id:

$ ./cmd.js users list
1337

and fetch the record for an id:

$ ./cmd.js users get 1337
{
  "name": "substack"
}

We can change records:

$ ./cmd.js users put 1337 --value.name=roboto
$ ./cmd.js users get 1337
{
  "name": "roboto"
}

And even check passwords from the command-line:

$ ./cmd.js users verify basic --username=substack --password=yo
1337
$ echo $?
0
$ ./cmd.js users verify basic --username=substack --password=yyyy
Error: verify failed
$ echo $?
1

methods

var command = require('accountdown-command')

var s = command(users, args=[], opts={}, cb)

Execute the shifted command-line arguments args to the accountdown instance users.

Return a readable stream s of printable content.

Optionally:

  • opts.command - command prefix to show in place of $0

usage

$0 create ID {OPTIONS}

  Create an account identified by ID with optional login and value properties:

  --login.TYPE.PROP=VALUE
  --value.PROP=VALUE

$0 list

  List all accounts by newline separated IDs.

$0 verify ID TYPE {CREDS}

  Verify an ID by the CREDS specific to the TYPE of login.

$0 get ID

  Get the value of an account by its ID as json.

$0 put ID VALUE

  Put a new VALUE (or --value) for an ID that has already been created.

$0 remove ID

  Remove an ID and all its logins.

$0 addlogin ID TYPE {CREDS}

  Add a login TYPE for an existing ID with login-specific properties CREDS.

$0 listlogin ID

  List each active login TYPE for ID on its own line.

$0 rmlogin ID TYPE

  Remove a TYPE login for ID.

$0 help

  Show this message.

install

With npm do:

npm install accountdown-command

license

MIT

Keywords

FAQs

Package last updated on 25 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc