Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1874 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

text.Arguments: parameter smushing with multiple short arguments doesn't work

Reported by: Deewiant Assigned to: kris
Priority: major Milestone: 1.0
Component: Tango Version: 0.99.9 Kai
Keywords: Cc: larsivi

Description

import tango.io.Stdout;
import tango.text.Arguments;

void main() {
	auto args = new Arguments;

	args("foo").aliased('f').params(1).smush;
	args("bar").aliased('b');
	if (args.parse("-b -fargument"))
		Stdout("OK").newline;
	args.clear();
	if (!args.parse("-bfargument"))
		Stdout(args.errors(&Stdout.layout.sprint));
}

The above code prints "OK" first, but then:

unexpected argument 'r'
unexpected argument 'm'
unexpected argument 'g'
unexpected argument 'n'
unexpected argument 'a'
argument 'foo' expects 1 parameter(s) but has 0
unexpected argument 'e'
unexpected argument 't'
unexpected argument 'u'

Both of the strings passed to args should be equivalent and result in the same parse.

(Also, the order of the errors is a bit weird...)

Change History

03/08/10 19:20:12 changed by kris

  • cc set to larsivi.
  • status changed from new to assigned.

yeah, I see what you mean. Hrm. What do you think, larsivi?

(the ordering is a result of using a hash-table for arguments, btw)

03/09/10 05:57:12 changed by kris

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [5401]) fixes #1874 :: parameter smushing with multiple short arguments doesn't work

thanks to deewiant