Software /
code /
clix
Comparison
clix.lua @ 8:df4cb4a73549
clix: Make short_opts table global, to allow commands to add their own short options
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 07 Jan 2010 02:05:48 +0000 |
parent | 7:6078e8d2b59d |
child | 11:a502c905527c |
comparison
equal
deleted
inserted
replaced
7:6078e8d2b59d | 8:df4cb4a73549 |
---|---|
5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
7 -- | 7 -- |
8 require "verse" | 8 require "verse" |
9 require "verse.client" | 9 require "verse.client" |
10 | |
11 -- Global to allow commands to add to it | |
12 short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", p = "password" } | |
10 | 13 |
11 local command = arg[1]; | 14 local command = arg[1]; |
12 | 15 |
13 if not command then | 16 if not command then |
14 print("Command Line XMPP, available commands:"); | 17 print("Command Line XMPP, available commands:"); |
81 return verse.loop(); | 84 return verse.loop(); |
82 end | 85 end |
83 | 86 |
84 table.remove(arg,1); | 87 table.remove(arg,1); |
85 | 88 |
86 local short_opts = { v = "verbose", t = "to", f = "from", e = "type", a = "account", p = "password" } | |
87 local opts = {}; | 89 local opts = {}; |
88 | 90 |
89 local args_handled_up_to; | 91 local args_handled_up_to; |
90 for i, opt in ipairs(arg) do | 92 for i, opt in ipairs(arg) do |
91 if opt:match("^%-") and opt ~= "--" then | 93 if opt:match("^%-") and opt ~= "--" then |