Skip to content

Commit

Permalink
Remove completed date from item output when --noStatus is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Regenhardt committed Feb 21, 2024
1 parent a799087 commit 142c560
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Todo.CLI/Handlers/ListCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static async Task Execute(IServiceProvider sp, bool all, bool noStatus,
Console.Write(" ");
}

Render(item);
Render(item, noStatus);
}
}

Expand All @@ -55,9 +55,9 @@ private static void Render(TodoList list)
foreach (var item in list.Tasks) Render(item);
}

private static void Render(TodoItem item)
private static void Render(TodoItem item, bool noStatus)
{
Console.WriteLine(item);
Console.WriteLine(item.ToString(noStatus));
}

private static void RenderBullet(TodoItem item)
Expand Down
1 change: 1 addition & 0 deletions src/Todo.Core/Model/TodoItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ public class TodoItem
public string? ListId { get; set; }

public override string ToString() => $"{Subject} - {Status} {(IsCompleted ? Completed?.ToString("yyyy-mm-dd") : string.Empty)}";
public string ToString(bool noStatus) => noStatus ? Subject : ToString();
}

0 comments on commit 142c560

Please sign in to comment.