Revision 181,
867 bytes
checked in by kazutaka, 15 years ago
(diff) |
更に修正
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[181] | 1 | -- extract package information for specified package(s). |
---|
| 2 | -- get list of package from standard input. |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | -- function. split strings and store it into table |
---|
| 6 | -- |
---|
| 7 | function split(str, d) |
---|
| 8 | |
---|
| 9 | local s = str |
---|
| 10 | local tbl = {} |
---|
| 11 | local p = "%s*(.-)%s*"..d.."%s*" |
---|
| 12 | local f = function(v) |
---|
| 13 | table.insert(tbl, v) |
---|
| 14 | end |
---|
| 15 | |
---|
| 16 | if s ~= nill then |
---|
| 17 | string.gsub(s, p, f) |
---|
| 18 | f(string.gsub(s, p, "")) |
---|
| 19 | end |
---|
| 20 | return tbl |
---|
| 21 | |
---|
| 22 | end |
---|
| 23 | |
---|
| 24 | -- main. read standard input and outpu package information |
---|
| 25 | -- |
---|
| 26 | apps = split(io.read()," ") |
---|
| 27 | |
---|
| 28 | for i, name in pairs(apps) do |
---|
| 29 | if pkgfind(name) then |
---|
| 30 | print("Package: "..pkgname(name)) |
---|
| 31 | print("Summary: "..pkgsummary(name)) |
---|
| 32 | print("Description: \n"..pkgdescr(name)) |
---|
| 33 | if pkgvercur(name) then |
---|
| 34 | print("State: Installed") |
---|
| 35 | else |
---|
| 36 | print("State: NotInstalled") |
---|
| 37 | end |
---|
| 38 | end |
---|
| 39 | end |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | |
---|
Note: See
TracBrowser
for help on using the repository browser.