public void Execute(CommitFile commitFile, CommitLine commitLine) { var newLine = commitFile.GetCommits() .FirstOrDefault(x => x.Line == commitLine.Line); newLine.SetType(key.ToLineType()); commitFile.Replace(commitLine, newLine); }
public ICommand GetCommand(string key, CommitLine commitLine) { if (key == null) return null; if (toggleKeys.Contains(key.ToUpper())) { var line = BuildLine()(commitLine.Line); return new ToggleCommand(key, line); } return null; }
public ToggleCommand(string key, CommitLine newCommitLine) { this.key = key; this.newCommitLine = newCommitLine; }
public void Replace(CommitLine old, CommitLine @new) { var index = lines.IndexOf(old.Line); lines.RemoveAt(index); lines.Insert(index, @new.Line); }