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