|
1 return function (opts, arg) |
|
2 if #arg == 0 or opts.help then |
|
3 return 0; |
|
4 end |
|
5 local conn; |
|
6 local function on_reply(reply) |
|
7 if not reply.error then |
|
8 if reply.name then |
|
9 print("Software:", reply.name); |
|
10 end |
|
11 if reply.version then |
|
12 print("Version:", reply.version); |
|
13 end |
|
14 if reply.platform then |
|
15 print("Platform:", reply.platform); |
|
16 end |
|
17 else |
|
18 print("Error requesting version ("..(reply.condition or "unknown")..")"..(reply.text and (": "..reply.text) or "")); |
|
19 end |
|
20 conn:close(); |
|
21 end |
|
22 local function on_connect(_conn) |
|
23 conn = _conn; |
|
24 conn:add_plugin("version"); |
|
25 conn:query_version(arg[1], on_reply); |
|
26 end |
|
27 clix_connect(opts, on_connect); |
|
28 end |