clix/version.lua

Wed, 06 Jan 2010 03:50:37 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 06 Jan 2010 03:50:37 +0000
changeset 0
ae83411a89c9
child 27
5b58c002d6ad
permissions
-rw-r--r--

Initial commit

return function (opts, arg)
	if #arg == 0 or opts.help then
		return 0;
	end
	local conn;
	local function on_reply(reply)
		if not reply.error then
			if reply.name then
				print("Software:", reply.name);
			end
			if reply.version then
				print("Version:", reply.version);
			end
			if reply.platform then
				print("Platform:", reply.platform);
			end
		else
			print("Error requesting version ("..(reply.condition or "unknown")..")"..(reply.text and (": "..reply.text) or ""));
		end
		conn:close();
	end
	local function on_connect(_conn)
		conn = _conn;
		conn:add_plugin("version");
		conn:query_version(arg[1], on_reply);
	end
	clix_connect(opts, on_connect);
end

mercurial