-
Notifications
You must be signed in to change notification settings - Fork 21
/
tessel.js
executable file
·84 lines (78 loc) · 3.06 KB
/
tessel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env node
// Copyright 2014 Technical Machine, Inc. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
require('../src/pester'); // force a current node version
function usage () {
console.error("Tessel CLI\nUsage:\n" +
" tessel list\n" +
" tessel logs\n" +
" tessel run <filename> [args...]\n" +
" run a script temporarily without writing it to flash\n" +
" -s push the specified file only (rather than associated files and modules)\n" +
" tessel push <filename> [options]\n" +
" see 'tessel push --help' for options list\n" +
" tessel erase\n" +
" erases saved usercode (JavaScript) on Tessel\n" +
" tessel repl\n" +
" interactive JavaScript shell\n" +
" tessel wifi -n <ssid> -p <pass> -s <security (wep/wpa/wpa2, wpa2 by default)>\n"+
" tessel wifi -n <ssid>\n" +
" connects to a wifi network without a password\n" +
" tessel wifi -l\n" +
" see current wifi status\n" +
" tessel stop\n" +
" stop the current script\n" +
" tessel check <file>\n" +
" dumps the tessel binary code\n" +
// " tessel dfu-restore [tag]\n" +
// " uploads new firmware when in DFU mode\n" +
// " no arguments: list available tags\n" +
// " relative or absolute path: pushes a local binary to tessel\n" +
" tessel blink\n" +
" uploads test blinky script\n" +
" tessel update [--list]\n" +
" updates tessel to the newest released firmware. Optionally can list all builds/revert to older builds.\n" +
" tessel debug [script]\n" +
" runs through debug script and uploads logs\n" +
" tessel version [--board]\n" +
" show version of tessel cli. If --board is specified, shows version of the connected Tessel\n" +
""
);
}
var builtinCommands = {
'blink': 'blink', 'blinky': 'blink', 'blinkie': 'blink', 'blinkee': 'blink',
'debug': 'debug',
'check': 'check',
'debug-stack': 'debug-stack',
'erase': 'erase',
'firmware': 'firmware',
'update': 'update', 'dfu-restore': 'update',
'list': 'list',
'logs': 'logs', 'listen': 'logs',
'node': 'run', 'run': 'run',
'pack': 'pack',
'ping': 'ping',
'push': 'push',
'repl': 'repl',
'stop': 'stop',
'verbose': 'verbose',
'version': 'version',
'wifi': 'wifi',
'install-drivers': 'install-drivers',
'trademark' : 'trademark',
'boot': 'boot',
}
if (process.argv.length < 3 || !builtinCommands[process.argv[2]]) {
usage();
process.exit(1);
}
// Launch subprocess as though it were ourself
var subprocess = './tessel-' + builtinCommands[process.argv[2]] + '.js';
process.argv.splice(1, 2, subprocess)
require(subprocess);