You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/01/06 02:43:29 UTC
[GitHub] [hbase] busbey commented on a change in pull request #4000: HBASE-26543 correct parsing of shell args with GetoptLong
busbey commented on a change in pull request #4000:
URL: https://github.com/apache/hbase/pull/4000#discussion_r779264961
##########
File path: hbase-shell/src/main/ruby/jar-bootstrap.rb
##########
@@ -78,62 +78,59 @@ def add_to_configuration(c, arg)
c
end
+conf_from_cli = nil
+
+# strip out any config definitions that won't work with GetoptLong
+D_ARG = '-D'.freeze
+ARGV.delete_if do |arg|
+ if arg.start_with?(D_ARG) && arg.include?('=')
+ conf_from_cli = add_to_configuration(conf_from_cli, arg[2..-1])
+ true
+ else
+ false
+ end
+end
+
opts = GetoptLong.new(
- [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
- [ '--debug', '-d', GetoptLong::OPTIONAL_ARGUMENT ],
- [ '--noninteractive', '-n', GetoptLong::OPTIONAL_ARGUMENT ],
- [ '--top-level-defs', GetoptLong::OPTIONAL_ARGUMENT ],
- [ '--Dkey=value', '-D', GetoptLong::NO_ARGUMENT ]
+ ['--help', '-h', GetoptLong::NO_ARGUMENT],
+ ['--debug', '-d', GetoptLong::NO_ARGUMENT],
+ ['--noninteractive', '-n', GetoptLong::NO_ARGUMENT],
+ ['--top-level-defs', GetoptLong::NO_ARGUMENT],
+ ['-D', GetoptLong::REQUIRED_ARGUMENT],
+ ['--return-values', '-r', GetoptLong::NO_ARGUMENT]
)
+opts.ordering = GetoptLong::REQUIRE_ORDER
Review comment:
no, this ordering option should bring us closer to before HBASE-24772 was introduced. I reasonably believe it is compatible with our parsing prior to that change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org