Raven.DBUtil.HelpText.Output C# (CSharp) Method

Output() public static method

public static Output ( ) : void
return void
		public static void Output()
		{
			Console.WriteLine();
			Console.WriteLine("Database Utility for RavenDB");
			Console.WriteLine("RavenDBUtil [/U <url>] <command> [options]");
			Console.WriteLine();
			Console.WriteLine("  /U - Specifies the URL to the RavenDB server.");
			Console.WriteLine("       The default is http://localhost:8080");
			Console.WriteLine();
			Console.WriteLine("Available Commands:");
			Console.WriteLine();
			Console.WriteLine("  TOUCH <dbname> - Touches the named database.");
			Console.WriteLine("  TOUCH <dbname> <dbname> <dbname3 - Touches multiple named databases.");
			Console.WriteLine("  TOUCH /ALL - Touches all databases.");
			Console.WriteLine();
		}
	}

Usage Example

コード例 #1
0
        internal static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                HelpText.Output();
                return((int)ExitCode.InvalidCommand);
            }

            try
            {
                var argsQueue = new Queue <string>(args);
                var nextArg   = argsQueue.Dequeue();

                // get the url from the command line
                string url = "http://localhost:8080";
                if (nextArg.ToUpper() == "/U")
                {
                    nextArg = argsQueue.Dequeue();
                    if (!nextArg.StartsWith("http", true, null))
                    {
                        HelpText.Output();
                        return((int)ExitCode.InvalidCommand);
                    }

                    url     = nextArg;
                    nextArg = argsQueue.Dequeue();
                }

                // get a document store to work with
                var documentStore = GetDocumentStore(url);

                // handle each command
                switch (nextArg.ToUpper())
                {
                case "TOUCH":
                    if (argsQueue.Count == 0)
                    {
                        goto default;
                    }

                    // get the database names from the command line
                    var dbNames = argsQueue.ToList();

                    // if we specified all databases with all -all or /all then touch all databases
                    if (dbNames.Any(x => x.Equals("/ALL", StringComparison.OrdinalIgnoreCase)))
                    {
                        Toucher.TouchAllDatabases(documentStore);
                        return((int)ExitCode.Success);
                    }

                    // touch just the databases we specified
                    Toucher.TouchDatabases(documentStore, dbNames);
                    return((int)ExitCode.Success);

                default:
                    HelpText.Output();
                    return((int)ExitCode.InvalidCommand);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message);
                return((int)ExitCode.Failure);
            }
        }
HelpText