Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[CommandLine] Deal with some TODO notes

  • Loading branch information...
commit 627b65e44874dd266e6ba31e31578e310c5f6420 1 parent f3db1a1
@Whiteknight authored
View
4 src/commandline/ArgumentDef.winxed
@@ -22,9 +22,6 @@ namespace Rosella.CommandLine.ArgumentDef
*/
class Rosella.CommandLine.ArgumentDef
{
- // TODO: Can we take positional aliases here in some way, with the rest of
- // the named argument defs for unified processing and description generation?
-
var raw_defs; // The raw argument definitions from the user
var prepared_defs; // The prepared/processed argument definitions
var aliases; // Map of aliased argument names
@@ -56,7 +53,6 @@ class Rosella.CommandLine.ArgumentDef
// definitions and the description message associated with each
function get_description(var sb = new 'StringBuilder')
{
- // TODO: Take a list of positional aliases and include those
self.__get_description_internal(self.raw_defs, sb);
return sb;
}
View
25 src/commandline/ModeCondition.winxed
@@ -68,7 +68,9 @@ class Rosella.CommandLine.ModeCondition.ScalarExists : Rosella.CommandLine.ModeC
function get_description(var sb)
{
- // TODO: This!
+ string name = self.scalarname;
+ push(sb, " ");
+ push(sb, self.__get_flag_name(name));
}
}
@@ -173,6 +175,25 @@ class Rosella.CommandLine.ModeCondition.NumPositionals : Rosella.CommandLine.Mod
function NumPositionals(int min, int max)
{
- // TODO: This
+ self.min_positionals = min;
+ self.max_positionals = max;
+ }
+
+ function is_satisfied(var args)
+ {
+ int min = int(self.min_positionals);
+ int max = int(self.max_positionals);
+ int n = elements(args.pos_cache);
+
+ if (min != -1 && n < min)
+ return false;
+ if (max != -1 && n > max)
+ return false;
+ return true;
+ }
+
+ function get_description(var sb)
+ {
+ //push(sb, " ...");
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.