From 2b185961e8dff79a4248b98c4c6345daa827d96a Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Wed, 31 Oct 2012 22:02:53 -0400 Subject: [PATCH] remove getopt lua module in reader.lua --- reader.lua | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/reader.lua b/reader.lua index d6ae51c9a..3b6eae487 100755 --- a/reader.lua +++ b/reader.lua @@ -74,11 +74,8 @@ function showusage() print("usage: ./reader.lua [OPTION] ... path") print("Read all the books on your E-Ink reader") print("") - print("-p, --password=PASSWORD set password for reading PDF document") - print("-G, --gamma=GAMMA set gamma correction") - print(" (floating point notation, e.g. \"1.5\")") - print("-d, --debug start in debug mode") - print("-h, --help show this usage help") + print("-d start in debug mode") + print("-h show this usage help") print("") print("If you give the name of a directory instead of a file path, a file") print("chooser will show up and let you select a file") @@ -92,19 +89,17 @@ end optarg, optind = alt_getopt.get_opts(ARGV, "p:G:hg:dg:", longopts) -if optarg["h"] then +if ARGV[1] == "-h" then return showusage() end -if not optarg["d"] then +local argidx = 1 +if ARGV[1] == "-d" then + argidx = argidx + 1 +else DEBUG = function() end end -if optarg["G"] ~= nil then - globalgamma = optarg["G"] -end - - if Device.isKindle4() then -- remove menu item shortcut for K4 Menu.is_enable_shortcut = false @@ -125,11 +120,11 @@ Screen.native_rotation_mode = Screen.cur_rotation_mode --87712cf0e43fed624f8a9f610be42b1fe174b9fe -if ARGV[optind] then - if lfs.attributes(ARGV[optind], "mode") == "directory" then - showFileManager(ARGV[optind]) - elseif lfs.attributes(ARGV[optind], "mode") == "file" then - showReader(ARGV[optind], optarg["p"]) +if ARGV[argidx] then + if lfs.attributes(ARGV[argidx], "mode") == "directory" then + showFileManager(ARGV[argidx]) + elseif lfs.attributes(ARGV[argidx], "mode") == "file" then + showReader(ARGV[argidx], optarg["p"]) end UIManager:run() elseif last_file and lfs.attributes(last_file, "mode") == "file" then