Bug 5316 – std.getopt: Add character-separated elements support for arrays and associative arrays

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-12-04T08:25:00Z
Last change time
2014-04-01T02:11:11Z
Keywords
pull
Assigned to
andrej.mitrovich
Creator
andrei

Attachments

IDFilenameSummaryContent-TypeSize
838patch.txtImplementationtext/plain928

Comments

Comment #0 by andrei — 2010-12-04T08:25:32Z
This patch adds the capability of invoking a program with ./my-program --tune=a=0,b=1,c=2 and initialize an associative array with ["a":0, "b":1, "c":2 ]. Submitted on behalf of Christopher Nicholson-Sauls.
Comment #1 by andrei — 2010-12-04T08:26:22Z
Created attachment 838 Implementation
Comment #2 by andrej.mitrovich — 2013-09-03T09:22:05Z
P.S. currently getopt bails badly on hashes: ----- import std.getopt; void main(string[] args) { int[string] tune; getopt(args, &tune, "tune"); } ----- C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(499): Deprecation: using * on an array is deprecated; use *(receiver).ptr instead C:\dmd-git\dmd2\windows\bin\..\..\src\phobos\std\getopt.d(499): Error: cannot modify immutable expression *cast(immutable(char)*)receiver
Comment #3 by andrej.mitrovich — 2013-09-03T09:29:02Z
(In reply to comment #2) > P.S. currently getopt bails badly on hashes: > > ----- > import std.getopt; > > void main(string[] args) > { > int[string] tune; > getopt(args, &tune, "tune"); > } > ----- Actually nevermind, the text argument should come before the address, but this is another area of improvement. I'll open another bug report for this.
Comment #4 by andrej.mitrovich — 2014-03-24T11:54:26Z
Comment #5 by github-bugzilla — 2014-03-31T23:34:31Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/9924b7aba5c4cf1a37fb4d6489cad45fe6b501b6 Fixes Issue 5316 - Add character-separated elements support for arrays and associative arrays.