Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo/path wildcard matching - closes #151 #150

Merged
merged 2 commits into from
Aug 4, 2022
Merged

Conversation

cdxn
Copy link
Contributor

@cdxn cdxn commented Jul 26, 2022

Summary

Adds support for use of repository and path wildcards in config:repoPaths to permit:

  • owner/* repo matching to common local path (path-segment/*)
  • match owner/* to path-segment/repo
  • prioritize full repo ( owner/repo: ~/somePath/target) when present
  • executes only when invoking runCustomCommand

Avoids having to individually add each repo-path combination for org/owner while retaining no-match/no-mapping behavior and prioritizing direct-mapped owner/repo to full path.

Assumes repo wildcard match is defined as owner/* and that path is well-formed partial path, ending with /*

First go attempt - chose simple strings manipulation over regexp given the limited matching cases of owner/repo, owner/*, path/.../*. Also chose to introduce getRepoLocalPath in modelUtils.go as a direct function vs. a type method, since it didn't appear elsewhere or make sense to be "generally useful from the Model"

Happy to revise or adjust approach.

How did you test this change?

  • Mapped custom command to cd to RepoPath, launch vs code, checkout PrNumber
  • Added config:repoPaths entries
  • Have been using it locally with many org repos to fix and refactor
repoPaths:
    owner/specific-repo: ~/code/specific-repo
    owner/*: ~/dev/owner/*

Incorrectly mapped paths, non-existent paths, repoPaths lookup misses retain error path when customCommand fails.

Images/Videos

closes #151

@cdxn cdxn changed the title repo/path wildcard matching repo/path wildcard matching - closes #151 Jul 26, 2022
@cdxn cdxn marked this pull request as ready for review July 28, 2022 15:41
@dlvhdr
Copy link
Owner

dlvhdr commented Aug 3, 2022

Thanks for the PR, looks awesome!
I'm gonna review it later this evening

Copy link
Owner

@dlvhdr dlvhdr left a comment

Choose a reason for hiding this comment

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

Looks good @cdxn!
Can you please also add an example of this to the readme?
There's a section about the repo paths.

@cdxn
Copy link
Contributor Author

cdxn commented Aug 4, 2022

good call - added within keybindings as sub-section - feel free to move/combine if you think it fits better elsewhere. I always forget the readme :D

@dlvhdr
Copy link
Owner

dlvhdr commented Aug 4, 2022

Awesome, thanks!

@dlvhdr dlvhdr merged commit b60ee6e into dlvhdr:main Aug 4, 2022
@cdxn cdxn deleted the repoPathWildcard branch August 4, 2022 14:39
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.

Support owner and path wildcards in repoPaths
2 participants