Skip to content

Commit

Permalink
feat(ux): 🚸 implement -C clear flag for start and continue (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNZL committed Jul 6, 2023
1 parent 5d54bee commit 7fd55fc
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/TogglTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,30 @@ private async ValueTask<List<Result>> _GetStartResults(CancellationToken token,

var results = new List<Result>();

if (query.SearchTerms.Contains(Settings.ClearDescriptionFlag))
{
bool escapeIfEmpty = (this._state.SelectedIds.Project != -1);

this._context.API.ChangeQuery($"{query.ActionKeyword} {((escapeIfEmpty) ? $"{Settings.EscapeCharacter} " : string.Empty)}");
return new List<Result>();
}
else if (this._settings.ShowUsageTips && !string.IsNullOrEmpty(query.Search))
{
results.Add(new Result
{
Title = Settings.UsageTipTitle,
SubTitle = $"Use {Settings.ClearDescriptionFlag} to quickly clear the description",
IcoPath = "tip.png",
AutoCompleteText = $"{query.ActionKeyword} {query.Search} {Settings.ClearDescriptionFlag} ",
Score = int.MaxValue - 300000,
Action = _ =>
{
this._context.API.ChangeQuery($"{query.ActionKeyword} {query.Search} {Settings.ClearDescriptionFlag} ");
return false;
}
});
}

if (this._settings.ShowUsageTips)
{
if (this._state.SelectedIds.Project == -1)
Expand Down

0 comments on commit 7fd55fc

Please sign in to comment.