Project

General

Profile

Actions

Feature #8862

open

getoptlong to accept user-provided commandline

Added by noon (Fabrice Bauzac) over 10 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:57013]

Description

=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)})) method to set (({@argv})) to a copy of the argument.
=end

No data to display

Actions

Also available in: Atom PDF

Like0