Skip to content

Separate cli functionality and data structure.#22

Merged
shahriaarrr merged 1 commit intoshahriaarrr:mainfrom
dhufe:feat_seperate_view
Jun 28, 2025
Merged

Separate cli functionality and data structure.#22
shahriaarrr merged 1 commit intoshahriaarrr:mainfrom
dhufe:feat_seperate_view

Conversation

@dhufe
Copy link
Contributor

@dhufe dhufe commented Jun 24, 2025

Hey there, when I was looking on your code I noticed that the Print()-function in tasky.go is only called by the cli-application and should be implemented in the application code and not in the data structure to separate them code. This also required to make the color-Methods public, since they aren't in the same package anymore.

It would be clearer if anyone wants to use the data struct for other applications (like in my case I'm using it to implement a bubbletea tui for it).

Cheers,
Daniel

@dhufe dhufe changed the title Separated cli functionality and data structure. Separate cli functionality and data structure. Jun 24, 2025
@shahriaarrr shahriaarrr requested a review from Copilot June 25, 2025 13:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR decouples CLI presentation logic from the core Todos data structure by removing the Print method and moving it into the CLI application, while exposing color helpers for external use.

  • Removed Print() from tasky.go to isolate data model from output formatting
  • Updated colors.go to export color functions (Red, Green, Blue)
  • Added PrintTable in the CLI (cli/tasky/main.go) and updated calls accordingly

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tasky.go Removed the Print method to separate CLI logic from the data model
colors.go Renamed color helpers to exported functions for external visibility
cli/tasky/main.go Introduced PrintTable, updated imports, and replaced tasks.Print
Comments suppressed due to low confidence (2)

colors.go:16

  • [nitpick] Add a Go doc comment above Red to describe its behavior, following Go documentation conventions for exported functions.
func Red(s string) string {

cli/tasky/main.go:235

  • Consider adding a unit test for PrintTable to validate table formatting and edge cases (e.g., empty list, all tasks done).
func PrintTable(tasks tasky.Todos) {

completedAt := "-"

if item.Done {
task = tasky.Green(item.Task) // green(item.Task)
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the commented-out // green(item.Task) comment to clean up redundant code.

Suggested change
task = tasky.Green(item.Task) // green(item.Task)
task = tasky.Green(item.Task)

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +16

"github.com/alexeyco/simpletable"

Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Group external imports (github.com/alexeyco/simpletable, github/tasky) on a separate block below the stdlib imports for clarity.

Suggested change
"github.com/alexeyco/simpletable"
)
import (
"github.com/alexeyco/simpletable"

Copilot uses AI. Check for mistakes.
@shahriaarrr
Copy link
Owner

shahriaarrr commented Jun 25, 2025

Hi dear @dhufe 👋
Thank you very much for contributing to the project and making it better✌️❤️💣

Unfortunately, I am not able to check this PR right now due to the Israeli invasion of my country, Iran, which has caused me to lose focus on my work and life. Of course, a ceasefire was established between them a day or two ago, but I still haven't been able to mentally organize my mind. That's why I can't check your PR right now, and I really apologize for that, but I will definitely do so in the next few days and merge this PR.🙏❤️

@dhufe
Copy link
Contributor Author

dhufe commented Jun 25, 2025

Hi @shahriaarrr,

don't worry, life comes first 😉.

Currently I'm working on a tui-app just for fun. If you're interested, leave me a comment.

tasky_list_bubbletea

@shahriaarrr
Copy link
Owner

Hi @shahriaarrr,

don't worry, life comes first 😉.

Currently I'm working on a tui-app just for fun. If you're interested, leave me a comment.

tasky_list_bubbletea tasky_list_bubbletea

Hi again and thanks. you can contact me with my email and share your ideas about it: shahriaarrr@gmail.com

@shahriaarrr shahriaarrr merged commit b0f677b into shahriaarrr:main Jun 28, 2025
1 check passed
@dhufe dhufe deleted the feat_seperate_view branch June 30, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants