soft-serve icon indicating copy to clipboard operation
soft-serve copied to clipboard

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

Open salasberryfin opened this issue 2 years ago • 3 comments

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 avatar Jan 25 '23 20:01 salasberryfin

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 avatar Feb 01 '23 19:02 salasberryfin

Any maintainer can take a look at this?

salasberryfin avatar Feb 10 '23 12:02 salasberryfin

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.

aymanbagabas avatar Feb 10 '23 18:02 aymanbagabas