private static void TestArgumentStrings()
        {
            ArgumentString argument_1_string = "argument 1";
            ArgumentString argument_2_string = ArgumentString.Required("argument 2");
            ArgumentString argument_3_string = ArgumentString.Optional("argument 3");

            Assert.IsFalse(argument_1_string.IsOptional);
            Assert.Equals(argument_1_string.Argument, "argument 1");
            Assert.IsFalse(argument_2_string.IsOptional);
            Assert.Equals(argument_2_string.Argument, "argument 2");
            Assert.IsTrue(argument_3_string.IsOptional);
            Assert.Equals(argument_3_string.Argument, "argument 3");
        }
 public FileSystemProgram()
 {
     standardOutputLogger = new Logger(this, ELoggerType.StandardOutput);
     errorOutputLogger    = new Logger(this, ELoggerType.ErrorOutput);
     commands.Add("append", "Append file contents to file", "This command appends file contents to the specified file path.", AppendCommand, "data");
     commands.Add("changedirectory", "Change directory", "This command changes directory.", ChangeDirectoryCommand, "directory path");
     commands.Add("createdirectory", "Create new directory", "This command creates a new directory.", CreateDirectoryCommand, "directory path");
     commands.Add("createfile", "Create new file", "This command creates a new file.", CreateFileCommand, "file path");
     commands.Add("currentdirectory", "Show current directory", "This command shows the current directory.", CurrentDirectoryCommand);
     commands.Add("delete", "Delete file or directory", "This command either deletes a file or a directory.", DeleteCommand, "path");
     commands.Add("help", "Help topics", "This command shows help topics.", HelpCommand);
     commands.Add("isdirectory", "Is a directory", "Shows if the specified path is a directory.", IsDirectoryCommand, "directory path");
     commands.Add("isfile", "Is a file", "Shows if the specified path is a file", IsFileCommand, "file path");
     commands.Add("ispath", "Is a path", "Shows if the specified path exists", IsPathCommand, "path");
     commands.Add("list", "List directories and files", "This command lists directories or files of the working directory or directories and files from the specified directory path.", ListCommand, ArgumentString.Optional("directory path"));
     commands.Add("read", "Read from file", "This command reads file contents from a file.", ReadCommand, "file path");
     commands.Add("save", "Save current state", "This command saves the current state.", SaveCommand);
     commands.Add("write", "Write file contents to file", "This command writes file contents to the specified file path.", WriteCommand, "file path", "data");
     commands.AddAliases("append", "a");
     commands.AddAliases("changedirectory", "cd");
     commands.AddAliases("createdirectory", "makedirectory", "createdir", "makedir", "mkdir", "md");
     commands.AddAliases("createfile", "cf");
     commands.AddAliases("currentdirectory", "pwd");
     commands.AddAliases("delete", "del", "rm");
     commands.AddAliases("help", "commands", "manual", "cmds", "cmd", "man", "h", "?");
     commands.AddAliases("list", "ls", "dir");
     commands.AddAliases("isdirectory", "isdir");
     commands.AddAliases("read", "r");
     commands.AddAliases("write", "w");
 }
Ejemplo n.º 3
0
 public LoggerProgram()
 {
     commands.Add("append", "Append logging data", "This command appends data to logger.", AppendCommand, "application ID", "data");
     commands.Add("applications", "List applications", "This command lists all applications that have written to that logger.", ApplicationsCommand);
     commands.Add("clear", "Clear data", "This command clears logging data.", ClearCommand, ArgumentString.Optional("application ID"));
     commands.Add("help", "Help topics", "This command shows help topics.", HelpCommand, ArgumentString.Optional("help topic"));
     commands.Add("read", "Read logging data", "This command reads output by dumping output data to \"Cutsom Data\".", ReadCommand, "application ID");
     commands.Add("write", "Write logging data", "This command writes logging data.", WriteCommand, "application ID");
     commands.AddAliases("append", "a");
     commands.AddAliases("applications", "apps");
     commands.AddAliases("clear", "c");
     commands.AddAliases("help", "commands", "manual", "cmds", "cmd", "man", "h", "?");
     commands.AddAliases("read", "r");
     commands.AddAliases("write", "w");
 }