Update
All commands are now moved to GitHub issues. Any further discussion of these commands should take place on their corresponding Issues:
- tessel provision: #64
- tessel [-h | --help]: #65
- tessel init: #76
- tessel rename: #77
- tessel erase: #78
- tessel run: #79
- tessel root: #80
- tessel update: #81
- tessel wifi: #82
- tessel list: #86
- tessel ap: #87
- tessel logs: #88
- tessel push: #91
- tessel select: no longer a command, see #93
- tessel status: #95
Original post
Spec for the T2 CLI. We've discussed it quite a bit internally (you can check out the comment history here if you're curious) but new insights are welcome.
This RFC is open until ~Monday, at which point I plan to turn this into many Github issues to implement.
CLI Commands
First things first
tessel provision
[ONLY WORKS OVER USB] creates a .tessel folder with ssh keys in your home directory and uses those ssh keys to authorize you to push code to the USB-connected Tessel
Authorized on device Tessel-0123456789ab (Rafael)
tessel [-h | --help]
Prints out all the commands and what they do (usage)
$ tessel
> Usage: tessel <command> [--help]
> help prints usage. Add ‘--help’ after any command for more info
> init initializes the current directory (package.json and blinky)
> list list nearby tessel devices
> select choose which tessel you want to interact with
> rename change the hostname of the selected tessel
> erase erase code pushed to flash
> logs display the console.logs from the currently running process
> push push a file to flash to be run anytime tessel is powered
> root provides access to the underlying linux system on board
> run run a file in RAM immediately
> status get the current status of the selected tessel
> update update the selected tessel to latest firmware build
> ap create a wireless access point on the selected tessel
> wifi configure wifi connection on the selected tessel
$
$ tessel --help
> Usage: tessel <command> [--help]
> ...
$
tessel init [directory]
Same as npm init. Creates package.json in the current working directory, or the provided directory. Also creates example index.js with blinky example code.
$ tessel init --help
> Usage: tessel init [dir] [--help]
> dir: initialize in the provided directory
$
$ tessel init
> Initializing tessel repository...
> Created package.json.
> Wrote “Hello World” to index.js.
$
For multiple tessels
tessel list
Lists all connected tessels. Shows which tessel is selected and authorization status of each tessel.
$ tessel list --help
> Lists all connected tessels. Shows which tessel is selected and authorization status of each tessel.
$
$ tessel list
> Searching for nearby tessels…
> USB/LAN Rafael [selected]
> LAN Bulbasaur
> LAN Tessel-456789abcdef
> LAN Mewcat (requires authorization with `tessel provision`)
> LAN Tessel-89abcdef0123 (requires authorization with `tessel provision`)
$
tessel select
Shows current tessel that you’ve selected. Upon selection, blink LED on tessel for 3 seconds.
$ tessel select --help
> Usage: tessel select <id | name> [--help]
> id|name: the id or name of the tessel to select
$
$ tessel select Bulbasaur
> Selected Bulbasaur (Tessel-23456789abcd) via LAN
$
$ tessel select Tessel-456789abcdef
> Selected Tessel-456789abcdef via LAN
$
$ tessel select
> Connected to Tessel-456789abcdef via LAN
$
Refers to selected tessel
tessel rename [-r | --reset]
Names the Tessel by changing the hostname of the device. Name restrictions found here: http://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names
$ tessel rename
> Usage: tessel rename <name> [-r | --reset] [-f | --force] [--help]
> name: the name to rename the currently selected tessel
> -r | --reset: reset the name of the device
$
$ tessel rename Jigglypuff
> Changed name of device Tessel-0123456789ab to Jigglypuff
$
$ tessel rename Snorlax
> Changed name of device Tessel-0123456789ab from Jigglypuff to Snorlax
$
$ tessel rename --reset
> Reset the name of device Tessel-0123456789ab
$
tessel erase
Erases code pushed to Flash using the tessel push command
$ tessel erase --help
> Usage: tessel erase [--help]
$
$ tessel erase
> Erasing files from flash...
> Files erased
$
tessel logs [-n ] [-t | --tail] [stdout | stderr]
Lists the recent activity and console.logs (100 lines default) from the running program
$ tessel logs --help
> Usage: tessel logs [-n <lines>] [-t | --tail] [-o <stdout | stderr>] [--help]
> -n: the number of lines of log to display
> -m|--monitor: continuously display the logs as they are updated
> stdout|stderr: display the logs from the specified output stream
$
$ tessel logs -n 2
> Bulbasaur is running index.js
> #[03/31/2015 18:10:28] This is my logggggg
> #[03/31/2015 18:10:29] Look at it!
$
$ tessel logs --tail
> Bulbasaur is running index.js
> #[03/31/2015 18:10:28] This is my logggggg
> #[03/31/2015 18:10:29] Look at it!
> #[03/31/2015 18:11:29] Look at it!
> #[03/31/2015 18:12:29] Look at it!
> #[03/31/2015 18:13:29] Look at it!
> #[03/31/2015 18:14:29] Look at it!
> #[03/31/2015 18:15:29] Look at it!
> #[03/31/2015 18:16:29] Look at it!
> #[03/31/2015 18:17:29] Look at it!
> #[03/31/2015 18:18:29] Look at it!
$
$ tessel logs -t stderr
> Bulbasaur is running index.js
> #[03/31/2015 18:10:28] Error: index.js:146 - index out of bounds yo
$
tessel push [--lan | --usb]
Push the file/dir to Flash memory to be run anytime the Tessel is powered, runs the file immediately once the file is copied over.
$ tessel push --help
> Usage: tessel push <index.js> [--usb | --lan] [--help]
> index.js: the Javascript file to push to flash
> --lan | --usb: connect over the specified connection type
$
$ tessel push index.js
> Writing index.js to flash on Mewcat (16kB)...
> Pushed index.js to Mewcat
> Running index.js...
> Hello world!
$
$ tessel push index.js --usb
> Writing index.js to flash on Mewcat (16kB)...
> Failed to write index.js to Mewcat (no usb connection)
$
tessel run [--lan | --usb]
Run the file in RAM immediately
$ tessel run --help
> Usage: tessel run <index.js> [--lan | --usb]
> index.js: the Javascript file to run in RAM
> --lan | --usb: connect over the specified connection type
$
$ tessel run index.js
> Running index.js on Bulbasaur...
> Hello world!
$
tessel root [-i ]
Provides access to the underlying Linux system running on Tessel 2: exactly SSH (copies regular SSH keys to authorize and SSHes in as Linux computer)
$ tessel root --help
> Usage: tessel root [-i <path>] [--help]
> -i <path>: provide a path to the desired ssh key
$
$ tessel root
> Accessing root...
root@192.168.128.124 #
tessel status
Prints name of the tessel and information about connection and running scripts
$ tessel status --help
> Prints name of the tessel and information about connection and running scripts
$
$ tessel status
> Name: Bulbasaur
> Ident: Tessel-23456789abcd
> IP: 192.168.2.5
> Script: index.js in RAM (16MB) started 03/31/2015 18:10:28
$
$ tessel status
> Name: Rafael
> Ident: Tessel-0123456789ab
> IP: 192.168.4.2
> USB: /dev/tty.usbmodem1422
> Script: no script running
$
tessel update [-l | --list] [-b | --build] [-f | --force]
Updates tessel to most recent build if it’s not already on that build, displays info including when tessel was last updated, when build was published
$ tessel update --help
> Usage: tessel update [-l | --list] [-b | --build]
> -l | --list: show the last five builds and current build
> -b | --build: update to a specific build
> -f | --force: force tessel to update to the specified version
$
$ tessel update
> New firmware version found...
> Updating Bulbasaur to latest build...
> Updated Bulbasaur from v0.3.12 to v0.3.14
$ tessel update
> Bulbasaur is already on the latest firmware build. You can force an update with “tessel update --force”
$
$ tessel update -b
> Usage: tessel update -b <build_number>
> Example: “tessel update -b 0.3.12”
> tessel update -b 0.3.12
> Updating Bulbasaur to v0.3.12...
> Updated Bulbasaur to v0.3.12
$
$ tessel update -l
> Latest builds:
> v0.3.14 Published 04/1/2015 03:35:57
> v0.3.13
> v0.3.12 Bulbasaur last updated 03/31/2015 08:22:03
> v0.3.11
> v0.3.10
> v0.3.09
$ tessel update
> New firmware version found...
> Updating Bulbasaur to latest build...
> Updated Bulbasaur from v0.3.12 to v0.3.14
$ tessel update -l
> Latest builds:
> v0.3.14 Bulbasaur last updated 03/31/2015 08:22:03 to latest firmware
> v0.3.13
> v0.3.12
> v0.3.11
> v0.3.10
> v0.3.09
$
tessel ap [-n ] [-p ] [-s ] [on|off]
Creates a wireless access point
$ tessel ap
> Usage: tessel ap [-n <ssid>] [-p <pass>] [-s <security>] [on|off]
> -n <ssid>: name of the network
> -p <pass>: password to access network
> -s <security>: encryption to use on network (i.e. WEP, WPA, PSK)
> on: bring up an access point that’s turned off
> off: turn off the access point
$
$ tessel ap -n test-network
> Created access point “test-network”
$
$ tessel ap off
> Turned off access point “test-network”
$
$ tessel ap -n test-network -p secret
> Created password protected access point “test-network”
$
$ tessel ap -n test-network -p secret -s WPA
> Created password protected access point “test-network” secured with WPA
$
$ tessel ap off
> Turned off access point “test-network”
$ tessel ap on
> Turned on access point “test-network”
$
tessel wifi
Show connection status, IP address, signal strength, bitrate
$ tessel wifi
> Usage: tessel wifi [-n <ssid>] [-p <pass>] [-s <security>] [--off] [-t]
> -l: show connection status and list available networks
> -n <ssid>: name of the network to connect with
> -p <pass>: password to access network
> -s <security>: security protocol to connect with (i.e. WEP, WPA, PSK)
> -t: attempt to connect for the provided number of seconds
> --off: disconnect from a wifi connection
$
$ tessel wifi -n test-network
> Connecting to network “test-network”...
> Connected to network “test-network”
$
$ tessel wifi -n test-network -p super-secret
> Connecting to network “test-network”...
> Failed to connect to “test-network” (ssid or password incorrect)
$ tessel wifi -n test-network -p secret
> Connecting to network “test-network”...
> Connected to network “test-network”
$
$ tessel wifi -n test-network -p secret -s WPA
> Connecting to network “test-network”...
> Connected to network “test-network”
$
$ tessel wifi -n test-network -t 1
> Connecting to network “test-network”...
> Failed to connect to “test-network” (timeout)
$
$ tessel wifi --list
> Currently connected to “test-network”
> Scanning for wifi connections...
> technicallyWifi (67/75)
> test-network (65/75) [connected]
> Gaumenkitzel (33/75)
$
Additional contributors to this spec: @nplus11 @jon @kevin @tcr