public void AddCommandToConsole() { // Adds command to the list of commands DeveloperConsole.AddCommandsToConsole(CommandText, this); // Prints in the console that it has done this DeveloperConsole.AddMessageToConsole(Name + " has been added to the console"); }
public void AddCommandToConsole() { string addMessage = " command has been added to the console."; DeveloperConsole.AddCommandsToConsole(Command, this); DeveloperConsole.AddMessageToConsole(Name + addMessage); }
public override void RunCommand(string[] param) { GitSystem gitSystem = GameObject.Find("GitObject").GetComponent <GitSystem>(); DeveloperConsole console = GameObject.Find("DeveloperConsoleObject").GetComponent <DeveloperConsole>(); if (param.Length == 1) { console.AddMessageToConsole("Error format"); return; } if (param[1] == "init") { if (param.Length != 2) { console.AddMessageToConsole("Error format"); } else { bool exist = GameObject.Find("GitObject").GetComponent <GitSystem>(); if (exist) { GameObject.Find("GitObject").GetComponent <GitSystem>().buildRepository(); } } } if (param[1] == "add") { if (param.Length != 3) { console.AddMessageToConsole("Error format"); } else { gitSystem.trackFile(param[2], "test"); } } if (param[1] == "remove") { if (param.Length != 3) { console.AddMessageToConsole("Error format"); } else { gitSystem.untrackFile(param[2]); } } if (param[1] == "commit") { if (param.Length != 4 || param[2] != "-m") { console.AddMessageToConsole("Error format"); } else { gitSystem.Commit(param[3]); } } if (param[1] == "remote") { if (param[2] == "add" && param.Length == 4) { gitSystem.addRemote(param[3]); } else { console.AddMessageToConsole("Error format"); } } if (param[1] == "push") { if (param.Length != 2) { console.AddMessageToConsole("Error format"); } else { gitSystem.Push(); } } if (param[1] == "clone") { if (param.Length != 3) { console.AddMessageToConsole("Error format"); } bool clone = gitSystem.cloneRepository(param[2]); if (!clone) { console.AddMessageToConsole("Cannot clone"); } } if (param[1] == "branch") { if (param.Length == 2) { Debug.Log(gitSystem.localRepository.branches.ToString()); } else if (param.Length == 3) { gitSystem.createBranch(param[2]); } else if (param.Length == 4 && param[2] == "-D") { gitSystem.deleteBranch(param[3]); } else { console.AddMessageToConsole("Error format"); } } if (param[1] == "checkout") { if (param.Length != 3) { console.AddMessageToConsole("Error format"); } else { gitSystem.checkout(param[2]); } } if (param[1] == "merge") { if (param.Length != 3) { console.AddMessageToConsole("Error format"); } else { gitSystem.Merge(param[2]); } } if (param[1] == "pull") { if (param.Length != 4) { console.AddMessageToConsole("Error format"); } else { gitSystem.Pull(param[2], param[3]); } } }