Exemple #1
0
        public override void Run(string[] args)
        {
            options = new CmdParserOptionSet()
            {
                { "h|help", "Display this help information. To see online help, use: git help <command>", v => OfflineHelp() },
                { "format=", "Format of the resulting archive: 'tar' or 'zip'", v => cmd.Format = v },
                { "l|list", "Show all available formats", v => cmd.List = true },
                { "v|verbose", "Report progress to stderr", v => cmd.Verbose = true },
                { "prefix=", "Prepend <prefix>/ to each filename in the archive", v => cmd.Prefix = v },
                { "o|output=", "Write the archive to <file> instead of stdout", v => cmd.Output = v },
                { "worktree-attributes", "Look for attributes in", v => cmd.WorktreeAttributes = true },
                { "remote=", "Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository", v => cmd.Remote = v },
                { "exec=", "Used with --remote to specify the path to the 'git-upload-archive' on the remote side", v => cmd.Exec = v },
            };

            try
            {
                List <String> arguments = ParseOptions(args);
                if (arguments.Count > 0)
                {
                    cmd.Arguments = arguments;
                    cmd.Execute();
                }
                else
                {
                    OfflineHelp();
                }
            }
            catch (Exception e)
            {
                cmd.OutputStream.WriteLine(e.Message);
            }
        }
        public void ProjectArchive_Execute_ReturnsNotFoundMessage()
        {
            var command = new ArchiveCommand(_console, LoggerMock.GetLogger <ArchiveCommand>().Object, _projectService.Object)
            {
                Name = "Project 2"
            };

            var resultMessage = command.Execute();

            Assert.Equal("Project Project 2 was not found", resultMessage);
        }
        public void ProjectArchive_Execute_ReturnsSuccessMessage()
        {
            var command = new ArchiveCommand(_console, LoggerMock.GetLogger <ArchiveCommand>().Object, _projectService.Object)
            {
                Name = "Project 1"
            };

            var resultMessage = command.Execute();

            Assert.Equal("Project Project 1 has been archived successfully", resultMessage);
        }