StartsWith() public method

Returns all commands starting with a specified string, sorted by command name.
public StartsWith ( String s ) : List
s String
return List
コード例 #1
0
ファイル: Program.cs プロジェクト: akrisiun/GitSharp
        /// <summary>
        /// Display the commands that start with the specified string.
        /// </summary>
        /// <param name="s"></param>
        /// <returns>Returns true if matches exist, otherwise false.</returns>
        private static bool ShowCommandMatches(String s)
        {
            CommandCatalog    catalog = new CommandCatalog();
            List <CommandRef> matches = catalog.StartsWith(s);

            if (matches.Count > 0)
            {
                foreach (CommandRef c in matches)
                {
                    Console.WriteLine("git: '" + s + "' is not a git command. See 'git --help'.");
                    Console.WriteLine();
                    Console.WriteLine("Did you mean this?");
                    Console.Write("      ");
                    Console.Write(c.getName());
                    for (int i = c.getName().Length + 8; i < 31; i++)
                    {
                        Console.Write(" ");
                    }
                    Console.Write(c.getUsage());
                    Console.WriteLine();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: yolanother/GitSharp
 /// <summary>
 /// Display the commands that start with the specified string.
 /// </summary>
 /// <param name="s"></param>
 /// <returns>Returns true if matches exist, otherwise false.</returns>
 private static bool ShowCommandMatches(String s)
 {
     CommandCatalog catalog = new CommandCatalog();
     List<CommandRef> matches = catalog.StartsWith(s);
     if (matches.Count > 0)
     {
         foreach (CommandRef c in matches)
         {
             Console.WriteLine("git: '" + s + "' is not a git command. See 'git --help'.");
             Console.WriteLine();
             Console.WriteLine("Did you mean this?");
             Console.Write("      ");
             Console.Write(c.getName());
             for (int i = c.getName().Length + 8; i < 31; i++)
                 Console.Write(" ");
             Console.Write(c.getUsage());
             Console.WriteLine();
         }
         return true;
     }
     else
     {
         return false;
     }
 }