kingdis

0.2.0 • Public • Published

kingdis

A CLI utility to work with redis

oclif Version Build Status Downloads/week License

Usage

$ npm install -g kingdis
$ kingdis COMMAND
running command...
$ kingdis (-v|--version|version)
kingdis/0.2.0 win32-x64 node-v10.11.0
$ kingdis --help [COMMAND]
USAGE
  $ kingdis COMMAND
...

Commands

kingdis help [COMMAND]

display help for kingdis

USAGE
  $ kingdis help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

kingdis lpush [OPTIONS]

lpush to a redis list from a file

USAGE
  $ kingdis lpush [OPTIONS]

OPTIONS
  -H, --host=host                  [default: 127.0.0.1] redis host
  -L, --list=list                  (required) the list where push the values
  -d, --db=db                      redis db
  -f, --file=file                  (required) the file to push. Each line will be a message

  -l, --line-handler=line-handler  a js file that must export a map function that receive a line in input and return a
                                   string

  -n, --pick=pick                  print the message payload every <pick> messages pushed. 0 to turn off

  -p, --port=port                  [default: 6379] redis port

  -u, --url=url                    redis:// URL connection

  -w, --password=password          redis auth password

DESCRIPTION
  ...
  checkout push command help for more info

EXAMPLES
  LPUSH a file to redis at port 6970:
    $ lpush -p 6970 -L my-list -f myFile.csv
  LPUSH a file and show the payload that is being processed by the line handler:
    $ lpush -f myFile.csv -L my-list --pick 1 -l ./script/my-transformation.js

See code: src\commands\lpush.js

kingdis publish [OPTIONS]

publish to a redis channel a file

USAGE
  $ kingdis publish [OPTIONS]

OPTIONS
  -H, --host=host                  [default: 127.0.0.1] redis host
  -c, --channel=channel            (required) the channel(s) where to publish the messages
  -d, --db=db                      redis db
  -f, --file=file                  (required) the file to publish. Each line will be a message

  -l, --line-handler=line-handler  a js file that must export a map function that receive a line in input and return a
                                   string

  -n, --pick=pick                  print the message payload every <pick> messages published. 0 to turn off

  -p, --port=port                  [default: 6379] redis port

  -u, --url=url                    redis:// URL connection

  -w, --password=password          redis auth password

DESCRIPTION
  ...
  Each line of the file will be read and submitted as-is in the redis' channels.

  Additionally you can transform each line with the line-handler. It must be a JavaScript file
  that export a sync function that receive the string line in input and must return a string:

  module.exports = function handler (line) {
     return JSON.stringify({ line })
  }

ALIASES
  $ kingdis pub

EXAMPLES
  Publish a file to redis at port 6970:
    $ publish -p 6970 -c my-channel -f myFile.csv
  Publish a file to multiple redis channels and show the payload that is being processed by the line handler:
    $ publish -c one -c two --pick 1 -f myFile.csv -l ./script/my-transformation.js

See code: src\commands\publish.js

kingdis push [OPTIONS]

push to a redis list from a file

USAGE
  $ kingdis push [OPTIONS]

OPTIONS
  -H, --host=host                  [default: 127.0.0.1] redis host
  -L, --list=list                  (required) the list where push the values
  -S, --side=right|left            [default: right] the list side where push. Will direct RPUSH or LPUSH
  -d, --db=db                      redis db
  -f, --file=file                  (required) the file to push. Each line will be a message

  -l, --line-handler=line-handler  a js file that must export a map function that receive a line in input and return a
                                   string

  -n, --pick=pick                  print the message payload every <pick> messages pushed. 0 to turn off

  -p, --port=port                  [default: 6379] redis port

  -u, --url=url                    redis:// URL connection

  -w, --password=password          redis auth password

DESCRIPTION
  ...
  Each line of the file will be read and pushed as-is in the redis' list.

  Additionally you can transform each line with the line-handler. It must be a JavaScript file
  that export a sync function that receive the string line in input and must return a string:

  module.exports = function handler (line) {
     return JSON.stringify({ line })
  }

EXAMPLES
  Push a file to redis at port 6970:
    $ push -p 6970 -L my-list -f myFile.csv
  Push a file with LPUSH to redis:
    $ push -S left -L my-list -f myFile.csv
  Push a file and show the payload that is being processed by the line handler:
    $ push -f myFile.csv -L my-list --pick 1 -l ./script/my-transformation.js

See code: src\commands\push.js

kingdis rpush [OPTIONS]

rpush to a redis list from a file

USAGE
  $ kingdis rpush [OPTIONS]

OPTIONS
  -H, --host=host                  [default: 127.0.0.1] redis host
  -L, --list=list                  (required) the list where push the values
  -d, --db=db                      redis db
  -f, --file=file                  (required) the file to push. Each line will be a message

  -l, --line-handler=line-handler  a js file that must export a map function that receive a line in input and return a
                                   string

  -n, --pick=pick                  print the message payload every <pick> messages pushed. 0 to turn off

  -p, --port=port                  [default: 6379] redis port

  -u, --url=url                    redis:// URL connection

  -w, --password=password          redis auth password

DESCRIPTION
  ...
  checkout push command help for more info

EXAMPLES
  RPUSH a file to redis at port 6970:
    $ rpush -p 6970 -L my-list -f myFile.csv
  RPUSH a file and show the payload that is being processed by the line handler:
    $ rpush -f myFile.csv -L my-list --pick 1 -l ./script/my-transformation.js

See code: src\commands\rpush.js

kingdis subscribe [OPTIONS]

subscribe to a redis channel and look inside of it

USAGE
  $ kingdis subscribe [OPTIONS]

OPTIONS
  -H, --host=host          [default: 127.0.0.1] redis host
  -c, --channel=channel    (required) the channel(s) to subscribe
  -d, --db=db              redis db
  -i, --interval=interval  [default: 1000] show how many messages a channel received in <interval> time
  -n, --pick=pick          print the message payload every <pick> messages received. 0 to turn off
  -p, --port=port          [default: 6379] redis port
  -s, --save               append the messages received to the file in cwd: %{ISO date}-%{channel name}.bak
  -u, --url=url            redis:// URL connection
  -w, --password=password  redis auth password

ALIASES
  $ kingdis sub

EXAMPLES
  Show the payload every 10 message received:
    $ subscribe -H 192.169.99.100 -p 6970 --pick 10 -c my-channel
  Show how many messages are published by redis in 10 seconds:
    $ subscribe -c my-channel --interval 10000
  Save all the messages to a file:
    $ subscribe -c my-channel --save

See code: src\commands\subscribe.js

Why this name?

redis starts with re that in italian means king.. so: kingdis!

License

Copyright Manuel Spigolon, Licensed under MIT.

Package Sidebar

Install

npm i kingdis

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

34.6 kB

Total Files

15

Last publish

Collaborators

  • eomm