Skip to content

feat: add alphabetical, commit and config order to ls and tui#212

Open
salasberryfin wants to merge 1 commit intocharmbracelet:mainfrom
salasberryfin:repositories-order
Open

feat: add alphabetical, commit and config order to ls and tui#212
salasberryfin wants to merge 1 commit intocharmbracelet:mainfrom
salasberryfin:repositories-order

Conversation

@salasberryfin
Copy link
Copy Markdown

@salasberryfin salasberryfin commented Jan 25, 2023

This is still WIP.
Related to #193.

The ideas behind these changes are:

  • Using config.yaml to set the type of order for the repositories: alphabetical, commit or config.
  • Adding a new field sorted to the RepoSource struct.
  • Implementing a method Sort on RepoSource.
  • Calling this method Sort when the configuration is loaded.
  • It applies for both ls and TUI.
  • The default behavior is to follow the order in config.yaml. The remaining repositories that don't appear in the config file are appended at the end with no specific order.
  • If using commit, the repositories with most recent commits are shown first.
  • Some tests were added as well.

After giving it some thought, this is what felt sensible to me. Is it aligned with the original idea?

Thanks in advance for the feedback.

@salasberryfin salasberryfin marked this pull request as ready for review February 1, 2023 19:10
@salasberryfin salasberryfin changed the title [WIP] feat: add alphabetical, commit and config order to ls and tui feat: add alphabetical, commit and config order to ls and tui Feb 1, 2023
@salasberryfin
Copy link
Copy Markdown
Author

salasberryfin commented Feb 1, 2023

I don't find a simple way to add a test that validates the commit date order. I welcome any suggestions.

Other than that I think it is ready to review.

@salasberryfin
Copy link
Copy Markdown
Author

Any maintainer can take a look at this?

@aymanbagabas
Copy link
Copy Markdown
Contributor

Thanks @salasberryfin for taking a look at this.

The idea I had in mind was like pinning repositories in GitHub. So the repos in config.yaml should always come first based on their order in the config. Other repositories, IMO, should be sorted by latest commit.
For ls, I think it's more sensible to make it mimic the shell ls command and sort repos in alphabetical order.

Let me know what you think.

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.

2 participants