Auto-select project if singular after merge

This commit is contained in:
Ryan McGuire 2023-12-10 11:50:47 -05:00
parent 50070cc667
commit 46ae4af9cd
3 changed files with 5 additions and 2 deletions

View File

@ -49,5 +49,5 @@ The basic workflow looks like this:
- [ ] Make a Makefile - [ ] Make a Makefile
- [ ] Add git repo status to project go (up-to-date, pending commits, etc..) - [ ] Add git repo status to project go (up-to-date, pending commits, etc..)
- [x] Merge aliases together for same project when selecting - [x] Merge aliases together for same project when selecting
- [ ] If after merging there is only one project, go there by default - [x] If after merging there is only one project, go there by default

View File

@ -24,7 +24,7 @@ func projectGoCmdRun(cmd *cobra.Command, args []string) {
if len(args) > 0 { if len(args) > 0 {
term = args[0] term = args[0]
} }
// project := getProject(args)
project := fzfSearchProjectAliases(term) project := fzfSearchProjectAliases(term)
if project == nil { if project == nil {

View File

@ -77,6 +77,9 @@ func fzfAliasFromAliases(ctx context.Context, aliases []*projects.ProjectAlias)
func fzfProjectFromAliases(ctx context.Context, aliases []*projects.ProjectAlias) ( func fzfProjectFromAliases(ctx context.Context, aliases []*projects.ProjectAlias) (
*gitlab.Project, error) { *gitlab.Project, error) {
mergedProjects := projectsFromAliases(aliases) mergedProjects := projectsFromAliases(aliases)
if len(mergedProjects) == 1 {
return mergedProjects[0], nil
}
return fzfProjectFromProjects(ctx, mergedProjects) return fzfProjectFromProjects(ctx, mergedProjects)
} }