public ITask <string> GetConfig(string key, GitConfigSource configSource, IOutputProcessor <string> processor = null) { Logger.Trace("GetConfig: {0}", key); return(new GitConfigGetTask(key, configSource, cancellationToken, processor) .Configure(processManager)); }
public ITask <string> SetConfig(string key, string value, GitConfigSource configSource, IOutputProcessor <string> processor = null) { Logger.Trace("SetConfig"); return(new GitConfigSetTask(key, value, configSource, cancellationToken, processor) .Configure(processManager)); }
public GitConfigGetAllTask(string key, GitConfigSource configSource, CancellationToken token, BaseOutputListProcessor <string> processor = null, ITask dependsOn = null) : base(token, processor ?? new SimpleListOutputProcessor(), dependsOn) { var source = ""; source += configSource == GitConfigSource.NonSpecified ? "--get-all" : configSource == GitConfigSource.Local ? "--get --local" : configSource == GitConfigSource.User ? "--get --global" : "--get --system"; arguments = String.Format("config {0} {1}", source, key); }
public GitConfigGetTask(string key, GitConfigSource configSource, CancellationToken token, IOutputProcessor <string> processor = null) : base(token, processor ?? new FirstNonNullLineOutputProcessor()) { var source = ""; source += configSource == GitConfigSource.NonSpecified ? "--get-all" : configSource == GitConfigSource.Local ? "--get --local" : configSource == GitConfigSource.User ? "--get --global" : "--get --system"; arguments = String.Format("config {0} {1}", source, key); }
public GitConfigUnSetTask(string key, GitConfigSource configSource, CancellationToken token, IOutputProcessor <string> processor = null) : base(token, processor ?? new SimpleOutputProcessor()) { var source = ""; source += configSource == GitConfigSource.NonSpecified ? "--unset" : configSource == GitConfigSource.Local ? "--local --unset" : configSource == GitConfigSource.User ? "--global --unset" : "--system --unset"; arguments = String.Format("config {0} {1}", source, key); Name = String.Format("config {0} {1}", source, key); }
public GitConfigSetTask(string key, string value, GitConfigSource configSource, CancellationToken token, IOutputProcessor <string> processor = null) : base(token, processor ?? new SimpleOutputProcessor()) { var source = ""; source += configSource == GitConfigSource.NonSpecified ? "" : configSource == GitConfigSource.Local ? "--replace-all --local" : configSource == GitConfigSource.User ? "--replace-all --global" : "--replace-all --system"; arguments = String.Format("config {0} {1} \"{2}\"", source, key, value); Name = String.Format("config {0} {1} \"{2}\"", source, key, new String('*', value.Length)); }
public GitConfigGetTask(IPlatform platform, string key, GitConfigSource configSource, CancellationToken token = default) : base(platform, null, outputProcessor: new FirstNonNullOutputProcessor <string>(), token: token) { Name = TaskName; var source = ""; source += configSource == GitConfigSource.NonSpecified ? "--get-all" : configSource == GitConfigSource.Local ? "--get --local" : configSource == GitConfigSource.User ? "--get --global" : "--get --system"; arguments = $"config {source} {key}"; }
public GitConfigUnSetTask(IPlatform platform, string key, GitConfigSource configSource, CancellationToken token = default) : base(platform, null, outputProcessor: new StringOutputProcessor(), token: token) { var source = ""; source += configSource == GitConfigSource.NonSpecified ? "--unset" : configSource == GitConfigSource.Local ? "--local --unset" : configSource == GitConfigSource.User ? "--global --unset" : "--system --unset"; arguments = $"config {source} {key}"; Name = $"config {source} {key}"; }
public GitConfigSetTask(IPlatform platform, string key, string value, GitConfigSource configSource, CancellationToken token = default) : base(platform, null, outputProcessor: new StringOutputProcessor(), token: token) { var source = ""; source += configSource == GitConfigSource.NonSpecified ? "" : configSource == GitConfigSource.Local ? "--replace-all --local" : configSource == GitConfigSource.User ? "--replace-all --global" : "--replace-all --system"; arguments = $"config {source} {key} \"{value}\""; Name = $"config {source} {key} \"{new string('*', value.Length)}\""; }
public GitConfigGetAllTask(string key, GitConfigSource configSource, CancellationToken token, BaseOutputListProcessor <string> processor = null) : base(token, processor ?? new SimpleListOutputProcessor()) { Guard.ArgumentNotNullOrWhiteSpace(key, nameof(key)); Name = TaskName; var source = ""; source += configSource == GitConfigSource.NonSpecified ? "--get-all" : configSource == GitConfigSource.Local ? "--get --local" : configSource == GitConfigSource.User ? "--get --global" : "--get --system"; arguments = String.Format("config {0} {1}", source, key); }
public GitConfigListTask(GitConfigSource configSource, CancellationToken token, BaseOutputListProcessor <KeyValuePair <string, string> > processor = null) : base(token, processor ?? new ConfigOutputProcessor()) { var source = ""; if (configSource != GitConfigSource.NonSpecified) { source = "--"; source += configSource == GitConfigSource.Local ? "local" : (configSource == GitConfigSource.User ? "system" : "global"); } arguments = String.Format("config {0} -l", source); }
public GitConfigGetAllTask(IPlatform platform, string key, GitConfigSource configSource, CancellationToken token = default) : base(platform, null, outputProcessor: new StringListOutputProcessor(), token: token) { Guard.ArgumentNotNullOrWhiteSpace(key, nameof(key)); Name = TaskName; var source = ""; source += configSource == GitConfigSource.NonSpecified ? "--get-all" : configSource == GitConfigSource.Local ? "--get --local" : configSource == GitConfigSource.User ? "--get --global" : "--get --system"; arguments = $"config {source} {key}"; }
public GitConfigListTask(IPlatform platform, GitConfigSource configSource, CancellationToken token = default) : base(platform, null, outputProcessor: new ConfigOutputProcessor(), token: token) { Name = TaskName; var source = ""; if (configSource != GitConfigSource.NonSpecified) { source = "--"; source += configSource == GitConfigSource.Local ? "local" : (configSource == GitConfigSource.User ? "system" : "global"); } arguments = $"config {source} -l"; }
///<inheritdoc/> public ITask <string> UnSetConfig(string key, GitConfigSource configSource) { return(new GitConfigUnSetTask(platform, key, configSource, Token) .Configure(platform.ProcessManager)); }
public GitConfigGetKey(string key, GitConfigSource gitConfigSource) { Key = key; GitConfigSource = gitConfigSource; }
///<inheritdoc/> public ITask <GitUser> SetConfigNameAndEmail(string username, string email, GitConfigSource configSource = GitConfigSource.User) { return(SetConfig(UserNameConfigKey, username, configSource) .Then(SetConfig(UserEmailConfigKey, email, configSource)) .Then(b => new GitUser(username, email))); }
///<inheritdoc/> public ITask <string> UnSetConfig(string key, GitConfigSource configSource, IOutputProcessor <string> processor = null) { return(new GitConfigUnSetTask(key, configSource, cancellationToken, processor) .Configure(processManager)); }