added --goto page comamnd-line argument

This commit is contained in:
Dobrica Pavlinusic
2011-11-17 02:12:35 +08:00
committed by HW
parent 7fafc61bb8
commit 83cfaad621

View File

@@ -35,16 +35,18 @@ KEY_BTN = 92
-- option parsing:
longopts = {
password = "p",
goto = "g",
gamma = "G",
device = "d",
help = "h"
}
optarg, optind = alt_getopt.get_opts(ARGV, "p:G:h", longopts)
optarg, optind = alt_getopt.get_opts(ARGV, "p:G:hg:", longopts)
if optarg["h"] or ARGV[optind] == nil then
print("usage: ./reader.lua [OPTION] ... DOCUMENT.PDF")
print("Read PDFs on your E-Ink reader")
print("")
print("-p, --password=PASSWORD set password for reading PDF document")
print("-g, --goto=page start reading on page")
print("-G, --gamma=GAMMA set gamma correction")
print(" (floating point notation, e.g. \"1.5\")")
print("-d, --device=DEVICE set device specific configuration,")
@@ -213,6 +215,6 @@ function mainloop()
end
end
goto(1)
goto(tonumber(optarg["g"]) or 1)
mainloop()