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

Discuss: Completion for Mac Defaults - The one where he hunts down Janathon Mah #1924

Closed
davidpfarrell opened this issue Aug 26, 2021 · 4 comments

Comments

@davidpfarrell
Copy link
Contributor

davidpfarrell commented Aug 26, 2021

@NoahGorny wrote:

I have searched far and wide for the original completion repo, but was unable to find it unfortunately..

With some googling and help from the WayBack machine, I tracked down the infamous "Jonathon Mah" :

Below are some links where I found versions of the completions in the wild.

Interesting to note is that the original version that @tswicegood committed in 2012 differs from these other versions in a significant way:

88c59
< 	if [[ ${COMP_WORDS[1]} == @(${cmds// /|}) ]]; then
---
> 	if [[ ${COMP_WORDS[1]} == [${cmds// /|}] ]]; then
100c71
< 	elif [[ ${COMP_WORDS[2]} == "-currentHost" ]] && [[ ${COMP_WORDS[2]} == @(${cmds// /|}) ]]; then
---
> 	elif [[ ${COMP_WORDS[2]} == "-currentHost" ]] && [[ ${COMP_WORDS[2]} == [${cmds// /|}] ]]; then
112c83
< 	elif [[ ${COMP_WORDS[3]} == "-host" ]] && [[ ${COMP_WORDS[3]} == @(${cmds// /|}) ]]; then
---
> 	elif [[ ${COMP_WORDS[3]} == "-host" ]] && [[ ${COMP_WORDS[3]} == [${cmds// /|}] ]]; then

You'll notice the original version uses the @(${cmds// /|}) technique that I mention on #1922

We could put a PR together to revert to this original version, but I have higher hopes:

@jmah Would you be interested (willing) to re-take control of this completion as a repo in your github profile, and then we could Vendor it back into bash-it from there? Additionally, do you happen to have any new updates to it?

Thanks,

-DF


cc: @jmah , @tswicegood

Discovered links for posterity:

@jmah
Copy link

jmah commented Aug 30, 2021

Why hello!

Would you be interested (willing) to re-take control of this completion as a repo in your github profile, and then we could Vendor it back into bash-it from there? Additionally, do you happen to have any new updates to it?

I'm happy to add it under my user for it to be vended from. For 5+ years I've switched to using fish shell so don't have any personal incentive to work on the bash ones. I don't have any updates, but I'm happy to incorporate them.

Is there a preferred repository layout for the vendored repositories? Looking at https://github.com/Bash-it/bash-it/tree/master/vendor/github.com it seems like there's a mix, with some having the completion file at the top-level.

@davidpfarrell
Copy link
Contributor Author

Hey @jmah thanks so much for replying !

re: Repository Layout

I think the django completion stands out since it exists as part of the full django project repo, but we only wanted the completion, so we vendored just the extras folder to isolate the completion.

The other two, jboss and apm, live as stand-alone completion repos, so we've vendored them in their entirety. I think your repository would likely be modeled on these.

Although the goal here is to capture defaults, you might consider a more general bash-completions repository, wherein the defaults completion would live, but would also leave room to resurrect a few of your other completions for posterity :) (or bash-completions-mac if they were all mac-related?)

So I'm thinking the layout might be something like one of these:

repo: bash-completions

  • LICENSE
  • README.md
  • mac/
    • defaults

or, if mac-specific:

repo: bash-completions-mac

  • LICENSE
  • README.md
  • defaults

Q: Do you have personal (ie. official) copies of your old completions?

I believe the version that bash-it contains was modified (and I believe broken) at time of first commit.

I have a version that I extracted from the old bash-completion gist linked in my other post, which I can provide if you don't have your old copies around.

Other Differences

The version in the wild differs from the bash-it version in another way:

< [ $UNAME = Darwin ] && have defaults &&
< {
  _defaults_domains()
  { 
  # ...
  }
  complete -F _defaults -o default defaults
< }

i.e the UNAME and have defaults checks have been removed from our version.

I understand if you feel strongly about keeping that logic, i.e. capturing the actual version of your script in your repository. If so, we would likely comment out that code in our version at time of vendoring.

Thank you again for replying, and please let us know your thoughts on this and how you might like to proceed.

Cheers!

-DF

@gaelicWizard
Copy link
Contributor

I accidentally already fixed it and just submitted PR #1928. I'd rather not be on the hook as the forever maintainer, but it seems like @jmah doesn't use Bash anymore...but I'd love those other completions too so if you've got them please do post them up!

@davidpfarrell
Copy link
Contributor Author

@jmah Just wanted to give you some closure on this.

@gaelicWizard has agreed to take ownership of the completion, vendoring it out into one their repos. As they still use it regularly and are making enhancements, I think it's a great outcome.

Thanks a lot for chiming in and good luck out there!

-DF

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

No branches or pull requests

3 participants