Skip to content

Commit

Permalink
Merge pull request #10 from corytodd/add_query_aliases
Browse files Browse the repository at this point in the history
[cli] add query parameter aliases
  • Loading branch information
corytodd authored Aug 25, 2021
2 parents 07d1a8d + cd33d4c commit 8144f60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions Walrus.CLI/Commands/QueryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,35 @@ public QueryCommand(IWalrusService walrus, ILogger<QueryCommand> logger) : base(
_logger = logger;

Command.AddOption(new Option<DateTime>(
"--after",
new[] {"--after", "-a"},
() => DateTime.Now.AddDays(-7),
"Return commits on or after this date. Defaults to one week ago."));

Command.AddOption(new Option<DateTime>(
"--before",
new[] {"--before", "-b"},
() => DateTime.Now.AddDays(1),
"Return commits before this date. Defaults to tomorrow."));

// All branches is slow so no short alias will be provided
Command.AddOption(new Option(
"--all-branches",
"Include all *local* branches in search"
));

Command.AddOption(new Option<string>(
"--author-email",
new[] {"--author-email", "-e"},
"Return commits from this author. Takes precendence over --author-alias."));

Command.AddOption(new Option<string>(
"--author-alias",
new[] {"--author-alias", "-u"},
"Return commits from any alias of this author"));

Command.AddOption(new Option<string>(
"--repo-name",
new[] {"--repo-name", "-r"},
"Return commits from this repository. Case insensitive."));

Command.AddOption(new Option<WalrusQuery.QueryGrouping>(
"--group-by",
new[] {"--group-by", "-g"},
"Result grouping method"
));

Expand All @@ -71,7 +72,7 @@ public QueryCommand(IWalrusService walrus, ILogger<QueryCommand> logger) : base(
/// <param name="query">Query to execute</param>
private void HandleQuery(WalrusQuery query)
{
_logger.LogDebug("HandleQuery: {query}", query);
_logger.LogDebug("HandleQuery: {Query}", query);

var commits = Walrus.ExecuteQuery(query);

Expand Down
4 changes: 2 additions & 2 deletions Walrus.Core/WalrusQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ config.AuthorAliases is not null &&
/// <inheritdoc />
public override string ToString()
{
return $"After={After}, Before={Before}, AllBranches={AllBranches}, Author.Email={AuthorEmail}, Author.Alias={AuthorAlias}, Grouping={GroupBy}";
return $"After={After}, Before={Before}, AllBranches={AllBranches}, Repo={RepoName}, Author.Email={AuthorEmail}, Author.Alias={AuthorAlias}, Grouping={GroupBy}";
}

public enum QueryGrouping
Expand All @@ -115,7 +115,7 @@ public enum QueryGrouping
Repo,

/// <summary>
/// Group commits by date (specifcally by day)
/// Group commits by date (specifically by day)
/// </summary>
Date,

Expand Down

0 comments on commit 8144f60

Please sign in to comment.