added --goto page comamnd-line argument

pull/2/merge
Dobrica Pavlinusic 13 years ago committed by HW
parent 7fafc61bb8
commit 83cfaad621

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

Loading…
Cancel
Save