Issue #8862 has been reported by noon (Fabrice Bauzac).

----------------------------------------
Feature #8862: getoptlong to accept user-provided commandline
https://bugs.ruby-lang.org/issues/8862

Author: noon (Fabrice Bauzac)
Status: Open
Priority: Normal
Assignee: 
Category: lib
Target version: 


=begin
Hello,

The (({getoptlong})) module (({class GetoptLong})) provides no way for the user to provide a commandline that is not (({ARGV})).  It appears that (({GetoptLong})) is tied to the (({ARGV})) global variable and this cannot be modified.  The fine (({getoptlong})) algorithms are not reusable in particular situations where the command is not in (({ARGV})), short of performing some kind of hack to temporarily modify (({ARGV})).

This ticket requests the addition of a way to redirect a (({GetoptLong})) object to eat a different (({Array})) of (({String})) than (({ARGV})).

One way to implement this would be to change the getoptlong code to use (({@argv})) instead of (({ARGV})), set (({@argv})) to a copy of (({ARGV})) in (({#initialize})), and provide a (({#set_commandline(Array<String>)})) method to set (({@argv})) to a copy of the argument.
=end



-- 
http://bugs.ruby-lang.org/