www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20459] New: Runtime arg parsing should stop at '--'

https://issues.dlang.org/show_bug.cgi?id=20459

          Issue ID: 20459
           Summary: Runtime arg parsing should stop at '--'
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

Currently runtime argument parsing (--DRT-gcopt for example) does not stop at
the POSIX-recommended value (double dash, '--').

There is a way to disable argument parsing completely
(https://github.com/dlang/druntime/pull/2375) but no way to write a program
that would take arguments that are passed to a child, like `dub` or `rdmd` do.

The three possible cases, using dub as an example, are:
- dub --DRT-gcopt:whatever -- ProgramArguments (Configure dub)
- dub -- --DRT-gcopt:whatever ProgramArguments (Configure the package)
- dub --DRT-gcopt:whatever -- --DRT-gcopt:whatever ProgramArguments (Configure
both)

Note that this approach isn't fully perfect: It assumes the program will use
`--` itself, which might not be true, but it's an improvement over what we
currently have.
Another option I could see is to provide a hook for argument parsing to
programs instead of adding those booleans (rt_cmdline_enabled,
rt_envvars_enabled, etc...).

--
Dec 19 2019