]> git.e2factory.org Git - e2factory.git/commitdiff
Handle errors from e2option.parse()
authorTobias Ulmer <tu@emlix.com>
Mon, 22 Apr 2013 14:18:07 +0000 (16:18 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 13:58:55 +0000 (14:58 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
13 files changed:
global/e2-create-project.lua
global/e2-fetch-project.lua
global/e2-install-e2.lua
global/e2.lua
local/e2-build.lua
local/e2-cf.lua
local/e2-dlist.lua
local/e2-dsort.lua
local/e2-fetch-sources.lua
local/e2-help.lua
local/e2-ls-project.lua
local/e2-new-source.lua
local/e2-playground.lua

index bb1137cedc8c8aee2583d899498703e666c7b0da..d3f3c09477a1e7e59947da2e7ffc37a620861b45 100644 (file)
@@ -39,6 +39,10 @@ local function e2_create_project(arg)
     e2lib.init()
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
+
     local rc, e = e2lib.read_global_config()
     if not rc then
         return false, e
index f9784b0aeb2bf80a7d5d18a300ba9799486bdec7..6d8db9dd1393fc168687aa60e44ca0903420a049 100644 (file)
@@ -43,6 +43,10 @@ local function e2_fetch_project(arg)
     e2option.option("tag", "retrieve a specific project tag")
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
+
     local rc, re = e2lib.read_global_config()
     if not rc then
         return false, e:cat(re)
index a64f232282d608b6803aa5f975b5e83567f092bd..39607511ef489609ef657eca368bddbc1c80fd54 100644 (file)
@@ -38,6 +38,9 @@ local function e2_install_e2(arg)
     e2lib.init()
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
 
     local root = e2lib.locate_project_root()
     if not root then
index 2c7f84d5ab1b2a07fdb50e96b6f9cacaae9abd94..24b6dd2ae8a21d13de46b24111d2a562825c3ba6 100644 (file)
@@ -58,7 +58,11 @@ local function e2(arg)
         e2call.arg_string = quoteargs(table.concat(arg, "' '", 2))
     elseif e2call.basename == "e2" then
         e2call.toolname = "e2"
-        local opts = e2option.parse(arg)
+        local opts, re = e2option.parse(arg)
+        if not opts then
+            return false, re
+        end
+
         if #opts == 0 then
             e2option.usage(1)
         end
index a7e90f386d442dca3d622ab33911063f0dcfa094..08739bb9ff33e5c517741314f6e4708ee3c863c2 100644 (file)
@@ -90,6 +90,9 @@ local function e2_build(arg)
     enable_writeback, "SERVER")
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
 
     -- get build mode from the command line
     local build_mode, re = policy.handle_commandline_options(opts, true)
index 8014ed469d5fe562588e509b32d747bc2cc07db7..ac60d1e14ab9543e1f213bc1d1f9cf69ee9205d1 100644 (file)
@@ -324,6 +324,9 @@ local function e2_cf(arg)
     end
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
 
     -- initialize some basics in the info structure without actually loading
     -- the project configuration.
index 37f9846ce35c9f5528f91abf432f36e47e9476c5..d64672f70898601a1dfe1a6f0b8cf56edaf1602d 100644 (file)
@@ -41,6 +41,9 @@ local function e2_dlist(arg)
 
     e2option.flag("recursive", "show indirect dependencies, too")
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
 
     if #arguments == 0 then
         return false,
index 12512628341b95a02d8f78d8def88f1265f517ad..7aee7992184b74166960b0bc84d2c6682aa20e9d 100644 (file)
@@ -39,7 +39,10 @@ local function e2_dsort(arg)
         return false, re
     end
 
-    e2option.parse(arg)
+    local opts, re = e2option.parse(arg)
+    if not opts then
+        return false, re
+    end
 
     info, re = e2tool.collect_project_info(info)
     if not info then
index fde3612c67983117235843a146867eb42be3a5e7..6168355b593bd487b2475fb85334998b69228e19 100644 (file)
@@ -58,6 +58,10 @@ local function e2_fetch_source(arg)
     e2option.flag("result", "select sources by result names")
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
+
     info, re = e2tool.collect_project_info(info)
     if not info then
         return false, info
index 97491fb47ca277396f09b2e41cd984bebf4bad8c..0b2dcaab4178c4b81b2b335c70fc89ffd51e56c5 100644 (file)
@@ -240,6 +240,9 @@ local function e2_help(arg)
     end
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
 
     info, re = e2tool.collect_project_info(info, true)
     if not info then
index 8731ad4b488ac4c5b40d822d56696f74808dcfa7..4cd9d76b10a790ebaae8a364a761ae4adc5ca703 100644 (file)
@@ -51,6 +51,9 @@ local function e2_ls_project(arg)
     e2option.flag("all", "show unused results and sources, too")
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
 
     info, re = e2tool.collect_project_info(info)
     if not info then
index 2a4a0a9728906656d9f30e7e9c8d06ba816d5462..181a3231b27e2056436ef26f186ad985fb5b5e8a 100644 (file)
@@ -223,6 +223,9 @@ local function e2_new_source(arg)
     e2option.option("server", "specify server")
     e2option.flag("no-checksum", "do not verify checksum file")
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
 
     info, re = e2tool.collect_project_info(info)
     if not info then
index c91c4e0cc1575f979b8dcb5211406b41d1f5f74e..b5ad2d567f6be7caef47b00d89fa6f049c7b7075 100644 (file)
@@ -52,6 +52,10 @@ local function e2_playground(arg)
     e2option.flag("showpath", "prints the path of the build directory inside the chroot to stdout" )
 
     local opts, arguments = e2option.parse(arg)
+    if not opts then
+        return false, arguments
+    end
+
     -- get build mode from the command line
     local build_mode, re = policy.handle_commandline_options(opts, true)
     if not build_mode then