예제 #1
0
        public void CatGoodArgsTest()
        {
            var expected = "231 5opsaf\r\nfsdhjf\r\nsdghrewt4bfdvd\r\ngs gdl;a";
            var actual   = new CatCommand().Execute("../../../TestFiles/file.txt");

            Assert.AreEqual(expected, actual);
        }
        public string GetFileContent(Changeset commit, string path)
        {
            var command = new CatCommand().WithFile(path);

            if (commit != null)
            {
                command = command.WithAdditionalArgument(string.Format("-r {0}", commit.RevisionNumber));
            }
            _repository.Execute(command);
            return(command.RawStandardOutput);
        }
예제 #3
0
        public static bool TryParse(string s, out CatCommand command)
        {
            command = null;

            if (PrivateMessage.TryParse(s, out var message))
            {
                if (message.Text.Contains("cat"))
                {
                    command = new CatCommand();
                    return(true);
                }
            }

            return(false);
        }
        public CommandApplier()
        {
            simulator = new BashSimulator();
            commands  = new Dictionary <string, ICommand>();
            CatCommand catCommand = new CatCommand();

            commands[catCommand.Name] = catCommand;
            WcCommand wcCommand = new WcCommand();

            commands[wcCommand.Name] = wcCommand;
            PwdCommand pwdCommand = new PwdCommand();

            commands[pwdCommand.Name] = pwdCommand;
            AnotherCommand anotherCommand = new AnotherCommand();

            commands[anotherCommand.Name] = anotherCommand;
            EchoCommand echoCommand = new EchoCommand();

            commands[echoCommand.Name] = echoCommand;
        }
예제 #5
0
 public bool DoesKnowCommand(CatCommand catCommand)
 {
     return(true);
 }
        public string GetFileContent(Changeset commit, string path)
		{
            var command = new CatCommand().WithFile(path);
			if (commit != null)
			{
				command = command.WithAdditionalArgument(string.Format("-r {0}", commit.RevisionNumber));
			}
            _repository.Execute(command);
            return command.RawStandardOutput;
		}