Skip to content

Commit 099a575

Browse files
committed
update and enhance commands output (the space in front of < and > is required) 🤷‍♂️
1 parent c86bb4f commit 099a575

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Diff for: hub.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,30 @@ var h = hub{
3838
connections: make(map[*connection]bool),
3939
}
4040

41+
const commands = "{\"Commands\": [" +
42+
"\"list\", " +
43+
"\"open < portName > < baud > [bufferAlgorithm: ({default}, timed, timedraw, timedbinary)]\", " +
44+
"\"send < portName > < cmd >\", " +
45+
"\"sendnobuf < portName > < cmd >\", " +
46+
"\"close < portName >\", " +
47+
"\"restart\", " +
48+
"\"exit\", " +
49+
"\"killupload\", " +
50+
"\"downloadtool < tool > < toolVersion: {latest} > < pack: {arduino} > < behaviour: {keep} >\", " +
51+
"\"log\", " +
52+
"\"memorystats\", " +
53+
"\"gc\", " +
54+
"\"hostname\", " +
55+
"\"version\"]} "
56+
4157
func (h *hub) run() {
4258
for {
4359
select {
4460
case c := <-h.register:
4561
h.connections[c] = true
4662
// send supported commands
4763
c.send <- []byte("{\"Version\" : \"" + version + "\"} ")
48-
c.send <- []byte("{\"Commands\" : [\"list\", \"open [portName] [baud] [bufferAlgorithm (optional)]\", \"send [portName] [cmd]\", \"sendnobuf [portName] [cmd]\", \"close [portName]\", \"restart\", \"exit\", \"program [portName] [board:name] [$path/to/filename/without/extension]\", \"programfromurl [portName] [board:name] [urlToHexFile]\"]} ")
64+
c.send <- []byte(commands)
4965
c.send <- []byte("{\"Hostname\" : \"" + *hostname + "\"} ")
5066
c.send <- []byte("{\"OS\" : \"" + runtime.GOOS + "\"} ")
5167
case c := <-h.unregister:

0 commit comments

Comments
 (0)