Esempio n. 1
0
        public BaseCommandHandlerParameter Insert(string name, string description)
        {
            var parameter = new BaseCommandHandlerParameter(name, description);

            _parameters.Insert(0, parameter);
            return(parameter);
        }
Esempio n. 2
0
        private IEnumerable <BaseCommandHandlerParameter> getUsages()
        {
            var commands = new List <BaseCommandHandlerParameter>();
            var usage    = getUsage();

            new UsageParser(usage)
            .Parse().ToList()
            .ForEach(y =>
            {
                var name = y.Name;
                if (!y.Required)
                {
                    name = "[" + name + "]";
                }
                if (y.Override)
                {
                    name = "[[" + name + "]]";
                }
                var cmd = new BaseCommandHandlerParameter(
                    name,
                    y.Description,
                    CommandType.FileCommand);
                y.Parameters.ToList()
                .ForEach(p => cmd.Add(p));
                commands.Add(cmd);
            });
            return(commands);
        }
Esempio n. 3
0
 private static void printParameter(BaseCommandHandlerParameter parameter, ref int level)
 {
     level++;
     var name = parameter.Name;
     if (!parameter.Required)
         name = "[" + name + "]";
     Console.WriteLine("{0}{1} : {2}", "".PadLeft(level, '\t'), name, parameter.Description);
     foreach (var child in parameter.Parameters)
         printParameter(child, ref level);
     level--;
 }
Esempio n. 4
0
 private void setNameProperties(BaseCommandHandlerParameter parameter, string rawName)
 {
     Override = false;
     Required = true;
     if (rawName.StartsWith("[["))
     {
         Override = true;
         return;
     }
     if (rawName.StartsWith("["))
     {
         Required = false;
     }
 }
Esempio n. 5
0
        private BaseCommandHandlerParameter parse(ref int index)
        {
            bool isTerminated;
            var  command = getCommand(ref index);

            if (command == null)
            {
                return(null);
            }
            var description = getDescription(ref index, out isTerminated);
            var cmd         = new BaseCommandHandlerParameter(command, description);

            if (!isTerminated)
            {
                getSubCommands(ref index).ForEach(x => cmd.Add(x));
            }
            return(cmd);
        }
Esempio n. 6
0
 private IEnumerable<BaseCommandHandlerParameter> getUsages()
 {
     var commands = new List<BaseCommandHandlerParameter>();
     var usage = getUsage();
     usage = stripDescription(usage);
     new UsageParser(usage)
         .Parse().ToList()
             .ForEach(y =>
                 {
                     var cmd = new BaseCommandHandlerParameter(
                         y.Name,
                         y.Description,
                         CommandType.FileCommand);
                     y.Parameters.ToList()
                         .ForEach(p => cmd.Add(p));
                     if (!y.Required)
                         cmd.IsOptional();
                     commands.Add(cmd);
                 });
     return commands;
 }
 public BaseCommandHandlerParameter Insert(string name, string description)
 {
     var parameter = new BaseCommandHandlerParameter(name, description);
     _parameters.Insert(0, parameter);
     return parameter;
 }
Esempio n. 8
0
 private IEnumerable<BaseCommandHandlerParameter> getUsages()
 {
     var commands = new List<BaseCommandHandlerParameter>();
     var usage = getUsage();
     new UsageParser(usage)
         .Parse().ToList()
             .ForEach(y =>
                 {
                     var name = y.Name;
                     if (!y.Required)
                         name = "[" + name + "]";
                     if (y.Override)
                         name = "[[" + name + "]]";
                     var cmd = new BaseCommandHandlerParameter(
                         name,
                         y.Description,
                         CommandType.FileCommand);
                     y.Parameters.ToList()
                         .ForEach(p => cmd.Add(p));
                     commands.Add(cmd);
                 });
     return commands;
 }
 public BaseCommandHandlerParameter Add(string name, string description)
 {
     var parameter = new BaseCommandHandlerParameter(name, description);
     _parameters.Add(parameter);
     return parameter;
 }
 public BaseCommandHandlerParameter Add(BaseCommandHandlerParameter parameter)
 {
     _parameters.Add(parameter);
     return parameter;
 }
Esempio n. 11
0
 protected override void usageAppender(BaseCommandHandlerParameter query)
 {
     query.Add("[LIMIT]", "Maximum records to return");
 }
 private void setNameProperties(BaseCommandHandlerParameter parameter, string rawName)
 {
     Override = false;
     Required = true;
     if (rawName.StartsWith("[[")) {
         Override = true;
         return;
     }
     if (rawName.StartsWith("["))
         Required = false;
 }
Esempio n. 13
0
 private IEnumerable<string> getPaths(BaseCommandHandlerParameter x, string path)
 {
     if (x.Parameters.Count() == 0)
         return new string[] { path };
     var paths = new List<string>();
     x.Parameters.ToList()
         .ForEach(y => paths.AddRange(getPaths(y, path + "/" + y.Name)));
     return paths;
 }
Esempio n. 14
0
 protected virtual void usageAppender(BaseCommandHandlerParameter query)
 {
 }
 protected override void usageAppender(BaseCommandHandlerParameter query)
 {
     query.Rebrand("HINT", "Token path hint file/directory");
 }
Esempio n. 16
0
 private void add(DefinitionCache cache, DefinitionCacheItem item, BaseCommandHandlerParameter parameter)
 {
     var name = parameter.Name;
     var child =
         item.Append(
                 item.Type,
                 item.Location,
                 item.Updated,
                 parameter.Override,
                 parameter.Required,
                 name,
                 parameter.Description);
     foreach (var cmd in parameter.Parameters)
         add(cache, child, cmd);
 }
Esempio n. 17
0
 private BaseCommandHandlerParameter parse(ref int index)
 {
     bool isTerminated;
     bool isRequired;
     var command = getCommand(ref index, out isRequired);
     if (command == null)
         return null;;
     var description = getDescription(ref index, out isTerminated);
     var cmd = new BaseCommandHandlerParameter(command, description);
     if (!isTerminated)
         getSubCommands(ref index).ForEach(x => cmd.Add(x));
     if (!isRequired)
         cmd.IsOptional();
     return cmd;
 }
Esempio n. 18
0
 private void overrideCommand(DefinitionCache cache, DefinitionCacheItem item, BaseCommandHandlerParameter parameter)
 {
     var command = cache.Add(
         item.Type,
         item.Location,
         item.Updated,
         parameter.Override,
         parameter.Required,
         parameter.Name,
         parameter.Description);
     foreach (var cmd in parameter.Parameters)
         add(cache, command, cmd);
 }
Esempio n. 19
0
 public BaseCommandHandlerParameter Add(BaseCommandHandlerParameter parameter)
 {
     _parameters.Add(parameter);
     return(parameter);
 }