Skip to content

Commit

Permalink
[CommandLine] Deal with some TODO notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Whiteknight committed Sep 4, 2012
1 parent f3db1a1 commit 627b65e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/commandline/ArgumentDef.winxed
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
25 changes: 23 additions & 2 deletions src/commandline/ModeCondition.winxed
Expand Up @@ -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));
}
}

Expand Down Expand Up @@ -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, " ...");
}
}

0 comments on commit 627b65e

Please sign in to comment.