Ejemplo n.º 1
0
        public string SwitchUsage(SwitchDefinition swdef)
        {
            string argSpec;

            if (swdef.IsFlag)
            {
                argSpec = "";
            }
            else
            {
                if (swdef.SwitchFormat != null)
                {
                    argSpec = " " + swdef.SwitchFormat;
                }
                else
                {
                    argSpec = " <string>";
                }
            }
            if (swdef.Required)
            {
                return(String.Format("{0}{1}{2}", SwitchPrefix, swdef.Name, argSpec));
            }
            else
            {
                return(String.Format("[{0}{1}{2}]", SwitchPrefix, swdef.Name, argSpec));
            }
        }
Ejemplo n.º 2
0
        private SwitchDefinition FindSwitch(CommandDefinition cdef, string tok)
        {
            SwitchDefinition swdef = null;
            var swname             = tok.Substring(SwitchPrefix.Length);

            if (cdef.Switches.TryGetValue(swname, out swdef))
            {
                return(swdef);
            }
            return(null);
        }
Ejemplo n.º 3
0
 public string SwitchUsage(SwitchDefinition swdef)
 {
     string argSpec;
     if (swdef.IsFlag)
     {
         argSpec = "";
     }
     else
     {
         if(swdef.SwitchFormat != null)
         {
             argSpec = " " + swdef.SwitchFormat;
         }
         else
         {
             argSpec = " <string>";
         }
     }
     if (swdef.Required)
     {
         return String.Format("{0}{1}{2}", SwitchPrefix, swdef.Name, argSpec);
     }
     else
     {
         return String.Format("[{0}{1}{2}]", SwitchPrefix, swdef.Name, argSpec);
     }
 }