From bd423ca47c9dc0e0575fe8b17c1a4bf77b63e08b Mon Sep 17 00:00:00 2001 From: Timur Kelman Date: Sat, 21 Aug 2021 13:27:09 +0200 Subject: [PATCH 1/2] argparse.lua: `hasArgument` in a comment refers to `hasArg` everywhere else --- library/lua/argparse.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/lua/argparse.lua b/library/lua/argparse.lua index 9b4e79a69..70b9c528e 100644 --- a/library/lua/argparse.lua +++ b/library/lua/argparse.lua @@ -79,7 +79,7 @@ end -- shortOptionName and handler are required. If the option takes an argument, -- it will be passed to the handler function. -- longOptionAlias is optional. --- hasArgument defaults to false. +-- hasArg defaults to false. -- -- example usage: -- From ca8d89df5ad9e6e8c52efb21823aad9faf6073d6 Mon Sep 17 00:00:00 2001 From: Timur Kelman Date: Sat, 21 Aug 2021 13:39:10 +0200 Subject: [PATCH 2/2] alt_getopt.lua: allow `?` as an option This makes it possible to call `script -?` --- library/lua/3rdparty/alt_getopt.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/lua/3rdparty/alt_getopt.lua b/library/lua/3rdparty/alt_getopt.lua index df4f51402..f6c2c5bae 100644 --- a/library/lua/3rdparty/alt_getopt.lua +++ b/library/lua/3rdparty/alt_getopt.lua @@ -50,7 +50,7 @@ local function get_opt_map(opts) local len = #opts local options = {} - for short_opt, accept_arg in opts:gmatch('(%w)(:?)') do + for short_opt, accept_arg in opts:gmatch('([%w%?])(:?)') do options[short_opt] = #accept_arg end