clix/version.lua

Mon, 16 Nov 2020 17:16:01 +0100

author
Kim Alvefur <zash@zash.se>
date
Mon, 16 Nov 2020 17:16:01 +0100
changeset 142
05ec7103c0f7
parent 27
5b58c002d6ad
permissions
-rw-r--r--

clix.watch_pep: Include short names for some common PEP nodes

0
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 return function (opts, arg)
27
5b58c002d6ad clix.*: Add --short-help and make sure they are working correctly
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
2 if opts.short_help then
5b58c002d6ad clix.*: Add --short-help and make sure they are working correctly
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
3 print("Query for the software of a client/server");
5b58c002d6ad clix.*: Add --short-help and make sure they are working correctly
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
4 return;
5b58c002d6ad clix.*: Add --short-help and make sure they are working correctly
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
5 end
0
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 if #arg == 0 or opts.help then
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 return 0;
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 local conn;
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 local function on_reply(reply)
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 if not reply.error then
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 if reply.name then
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 print("Software:", reply.name);
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 if reply.version then
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 print("Version:", reply.version);
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 if reply.platform then
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 print("Platform:", reply.platform);
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 else
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22 print("Error requesting version ("..(reply.condition or "unknown")..")"..(reply.text and (": "..reply.text) or ""));
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24 conn:close();
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26 local function on_connect(_conn)
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27 conn = _conn;
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
28 conn:add_plugin("version");
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
29 conn:query_version(arg[1], on_reply);
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 end
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
31 clix_connect(opts, on_connect);
ae83411a89c9 Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32 end

mercurial