soft-serve
soft-serve copied to clipboard
feat: add alphabetical, commit and config order to ls and tui
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
orconfig
. - Adding a new field
sorted
to theRepoSource
struct. - Implementing a method
Sort
onRepoSource
. - 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.
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.
Any maintainer can take a look at this?
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.