Config option and cli command

This commit is contained in:
Cyberboss
2017-10-16 13:26:33 -04:00
parent 1f100b1e3d
commit a2c71ef16f
6 changed files with 110 additions and 24 deletions
+37 -1
View File
@@ -9,7 +9,7 @@ namespace TGCommandLine
public RepoCommand()
{
Keyword = "repo";
Children = new Command[] { new RepoSetupCommand(), new RepoUpdateCommand(), new RepoGenChangelogCommand(), new RepoPushChangelogCommand(), new RepoPythonPathCommand(), new RepoSetEmailCommand(), new RepoSetNameCommand(), new RepoMergePRCommand(), new RepoListPRsCommand(), new RepoStatusCommand(), new RepoListBackupsCommand(), new RepoCheckoutCommand(), new RepoResetCommand(), new RepoUpdateJsonCommand() };
Children = new Command[] { new RepoSetupCommand(), new RepoUpdateCommand(), new RepoGenChangelogCommand(), new RepoPushChangelogCommand(), new RepoPythonPathCommand(), new RepoSetEmailCommand(), new RepoSetNameCommand(), new RepoMergePRCommand(), new RepoListPRsCommand(), new RepoStatusCommand(), new RepoListBackupsCommand(), new RepoCheckoutCommand(), new RepoResetCommand(), new RepoUpdateJsonCommand(), new RepoSetPushTestmergeCommitsCommand() };
}
public override string GetHelpText()
{
@@ -17,6 +17,41 @@ namespace TGCommandLine
}
}
class RepoSetPushTestmergeCommitsCommand : Command
{
public RepoSetPushTestmergeCommitsCommand()
{
Keyword = "push-testmerges";
RequiredParameters = 1;
}
public override string GetHelpText()
{
return "Set if a temporary branch is to the remote when we make testmerge commits and then delete it";
}
public override string GetArgumentString()
{
return "<on|off>";
}
protected override ExitCode Run(IList<string> parameters)
{
switch (parameters[0].ToLower())
{
case "on":
Server.GetComponent<ITGRepository>().SetPushTestmergeCommits(true);
break;
case "off":
Server.GetComponent<ITGRepository>().SetPushTestmergeCommits(false);
break;
default:
OutputProc("Invalid option!");
return ExitCode.BadCommand;
}
return ExitCode.Normal;
}
}
class RepoUpdateJsonCommand : Command
{
public RepoUpdateJsonCommand()
@@ -97,6 +132,7 @@ namespace TGCommandLine
OutputProc("Remote: " + remote + " (" + remotehead + ")");
OutputProc("Branch: " + branch);
OutputProc("HEAD: " + head);
OutputProc("Push testmerge commits: " + (Repo.PushTestmergeCommits() ? "ON" : "OFF"));
OutputProc(String.Format("Committer Identity: {0} ({1})", Repo.GetCommitterName(), Repo.GetCommitterEmail()));
}
else