npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

linkercli

v1.0.6

Published

Linker CLI is a command line interface for LinkerIoT Platform, it provide user to remote control with LinkerIoT platform managed devices using RESTful way and also interactive way.

Downloads

1

Readme

README - linkercli

Linker CLI is a command line interface for LinkerIoT Platform, it provide user to remote control with LinkerIoT platform managed devices using RESTful way and also interactive way.

Linker IoT Platform

LinkerIoT platform is a platform that provide cloud connect with your devices. And we also provide related remote managed features for user to control their devices to install, remove or upgrade. More detail, please see: http://linkeriot.io.

Install

npm install linkercli -g

Before Start

If you using private LinkerIoT platform, please set the environment first:

export IOT_SERVER=http://your-server-url:port

Help page

Linker CLI implement help page to let you use "--help" to show command support.

$ linkercli --help

  Usage: linkercli [options] [command]


  Commands:

    config [options] [env]      login to linker service
    project [options] [env]     project related operation
    auth [options] [env]        login to linker service
    token [env]                 get current login token
    device|dev [options] [env]  device related command
    *

  Options:

    -h, --help           output usage information
    -V, --version        output the version number
    -C, --config [UUUU]  The account username of linkeriot (should be an email)

For sub-command help page:

linkercli [sub-command] --help

You can try like this:

$ linkercli auth --help

  Usage: auth [options] [env]

  login to linker service

  Options:

    -h, --help                 output usage information
    -u, --username [username]  The account username of linkeriot (should be an email)
    -p, --password [password]  The account password of linkeriot

For excape some device id, please use "/" for escape:

ex: -AZwXZrybGFFVPyqAAAD as device id, can be escape use "/-AZwXZrybGFFVPyqAAAD"

linkercli dev clear --deviceid "/-AZwXZrybGFFVPyqAAAD"

Auth / Login

Before use of linkercli tool, you need to auth use your username and password.

$ linkercli auth -u your-account -p your-password

{ code: 200,
  msg: 'ok',
  token: '057d0e28d600931e87002958905c4a76d401e402711f06337331de37db40527100b9fc15de3dcb8705abeb189b247fe3' }

Project releated

The related project managed feature can use the project related command.

List your projects

If you already have project in out platform, you can list the project like:

$ linkercli prj list | json

[
  {
    "project_id": "aaaa-bbbb-cccc-dddd",
    "data": {
      "project_alias": "simon-project2",
      "project_archs": [
        "rpi-armv7l",
        "rpi-arm64"
      ],
      "download_urls": {
        "rpi-armv7l": null,
        "rpi-arm64": null
      },
      "create_time": 1460108981483
    }
  }
]

Create project

If you want to create a new project, you need to specify the project name, alias and the cpu architecture that you want to include in the project.

$ linkercli project create -p simon-project -a project-alias -r rpi-armv7l -r rpi-arm64

Get device image

After the device create, system will create the project image in background. And you can download the image using "linkercli project download" command.

$ linkercli prj download -p simon-project -r rpi-armv7l -O /tmp

List devices

If you already have devices in LinkerIoT platform, you can use the device related sub-command to show related information.

$ linkercli dev list -s active | json
[
  {
    "_id": "mxY6yqIkQzb9hZ9SAAAE",
    "hostname": "cubietruck",
    "mem_used": 0.2228827646798143,
    "cpu_used": 0.013967527165392735,
    "arch": "ARMv7 Processor rev 4 (v7l)",
    "ip_detail": {
      "eth0": [
        {
          "address": "192.168.105.123",
          "netmask": "255.255.255.0",
          "family": "IPv4",
          "mac": "02:01:06:41:82:58",
          "internal": false
        },
        {
          "address": "fe80::1:6ff:fe41:8258",
          "netmask": "ffff:ffff:ffff:ffff::",
          "family": "IPv6",
          "mac": "02:01:06:41:82:58",
          "scopeid": 4,
          "internal": false
        }
      ]
    },
    "ips": [
      "192.168.105.123"
    ],
    "rootdisk": 0.8638665072108402,
    "id": "mxY6yqIkQzb9hZ9SAAAE",
    "deviceId": "mxY6yqIkQzb9hZ9SAAAE",
    "projectInfo": {
      "projectid": "simon-project",
      "ownerid": "[email protected]",
      "owner": "[email protected]"
    },
    "status": "active"
  }
]

Get device running jobs/containers

Once you get the device id, you can look into the running job/container inside the device.

$ linkercli dev ps -d a_54ERXdr4inKCGiAAAA | json
[
  {
    "containerId": "c4c2d8bc7815",
    "command": "\"node web.js\"",
    "image": "git.linkeriot.io:5000/simonsu/sample",
    "createAt": "2016-04-19 02:30:30 +0000 UTC",
    "created": "27 minutes",
    "ports": "0.0.0.0:1337->1337/tcp",
    "status": "Up 27 minutes",
    "size": "0 B",
    "names": "mad_nobel"
  }
]

Service lifecycle in a device

Run a job/container in a device

$ linkercli device run -d a_54ERXdr4inKCGiAAAA -i git.linkeriot.io:5000/simonsu/sample -c "node web.js" -P

Stop the job/container

$ linkercli device rm -d a_54ERXdr4inKCGiAAAA  -I a587c1013c4f

Show the exist images in a device

$ linkercli device images -d a_54ERXdr4inKCGiAAAA  

Get an image into device

$ linkercli dev pull -i git.linkeriot.io:5000/simonsu/sample  -P -d a_54ERXdr4inKCGiAAAA

Delete image in a device

$ linkercli device rm -d a_54ERXdr4inKCGiAAAA  -I a587c1013c4f

List process in a device

$ linkercli dev ps -d a_54ERXdr4inKCGiAAAA | json
[
  {
    "containerId": "09bcc774d9da",
    "command": "\"sh\"",
    "image": "linkerlab/rpi-node:5.9.1-armv7l",
    "createAt": "2016-04-08 08:28:12 +0000 UTC",
    "created": "14 minutes",
    "ports": "",
    "status": "Up 14 minutes",
    "size": "0 B",
    "names": "prickly_shockley"
  }
]

You can also show all process, like:

linkercli dev ps -d a_54ERXdr4inKCGiAAAA --showall |json
[
  {
    "containerId": "f311d7f46e61",
    "command": "\"node web.js\"",
    "image": "git.linkeriot.io:5000/simonsu/sample",
    "createAt": "2016-04-08 08:56:28 +0000 UTC",
    "created": "59 seconds",
    "ports": "",
    "status": "Up 57 seconds",
    "size": "0 B",
    "names": "sharp_lumiere"
  },
  {
    "containerId": "e9ec2a2c8fcb",
    "command": "\"node linkeragent\"",
    "image": "git.linkeriot.io:5000/linkeriot/linker-rpi-agent:armv7l",
    "createAt": "2016-04-08 07:32:22 +0000 UTC",
    "created": "About an hour",
    "ports": "",
    "status": "Up 24 minutes",
    "size": "0 B",
    "names": "hungry_goldstine"
  }
]

Stop container in a device

$ linkercli dev stop -d a_54ERXdr4inKCGiAAAA -I 09bcc774d9da

{
  "code": 200,
  "msg": {
    "err": null,
    "stdo": "09bcc774d9da\n",
    "stde": ""
  }
}

Remove container in a device

$ linkercli dev rm -d a_54ERXdr4inKCGiAAAA -I 09bcc774d9da | json

{
  "code": 200,
  "msg": {
    "err": null,
    "stdo": "09bcc774d9da\n",
    "stde": ""
  }
}

LinkerIoT interactive mode - linkercli-it

linkercli-it is an interactive mode shell for user to interactive with their device like SSH or Telnet. Before use of linkercli-it, you need to retrieve the device id as input to connect with.

$ linkercli-it a_54ERXdr4inKCGiAAAA
***********************************************************************************
 You already connect to device a_54ERXdr4inKCGiAAAA
 Now, you can use the device related command to interactive with your device...
 Please use command "quit" or "exit" for leave the session!
***********************************************************************************
? a_54ERXdr4inKCGiAAAA → ls -l
total 48
-rw-r--r--  1 root root 1828 Apr  8 06:28 builder.js
drwxr-xr-x  2 root root 4096 Apr  8 06:29 lib
-rw-r--r--  1 root root 4951 Apr 13 14:02 linkeragent.js
drwxr-xr-x 44 root root 4096 Apr 14 08:06 node_modules
-rw-r--r--  1 root root  347 Apr  7 08:50 package.json
-rw-r--r--  1 root root 1177 Feb 10 14:45 sample-webhook.json
drwxr-xr-x  2 root root 4096 Apr 13 11:02 scripts
-rw-r--r--  1 root root 3520 Feb 25 10:13 stat.js
-rw-r--r--  1 root root   72 Mar 11 11:24 test-guid.js
-rw-r--r--  1 root root  608 Apr  7 09:06 test.js
-rw-r--r--  1 root root   52 Apr 14 07:43 test.yml