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

Bash completion for fig command #639

Merged
merged 2 commits into from
Jan 13, 2015
Merged

Conversation

albers
Copy link

@albers albers commented Nov 12, 2014

This work is based on the wonderful bash completion for the docker command.
I placed it in the same location as in the docker repository.

@albers albers mentioned this pull request Nov 12, 2014
@aanand
Copy link

aanand commented Nov 12, 2014

Very nice - will give it a try later.

Some docs would be great (including how to set it up in zsh, for us snobs). Not sure where would be best - perhaps cli.md, perhaps a separate page.

@albers
Copy link
Author

albers commented Nov 13, 2014

I think the only documentation needed is how to install the completion.

If completion were part of the next release, e.g. 1.0.2, the install instructions in install.md could be extended with something like

To install command completion for the bash shell (optional):
curl -L https://github.com/docker/fig/releases/download/1.0.2/fig-completion > /etc/bash_completion.d/fig

I don't know how to use this in zsh. I tried @lePoxy's trick from #338 but was unseccusful:

docker2# fig _fig:20: command not found: _get_comp_words_by_ref
_fig:27: parse error: condition expected: 1
fig
( build kill port pull rm scale stop
) help logs ps restart run start up

This is probably because _get_comp_words_by_refis a function defined in bash completion itself.

@albers
Copy link
Author

albers commented Nov 13, 2014

By the way, are there any ways to join with Docker's release channels?

I'd really like to see an officially signed Ubuntu package with the fig binary and completion that can be installed from the Docker repository, see https://docs.docker.com/installation/ubuntulinux/.

@SvenDowideit
Copy link

@albers I'm pretty sure you'd need to make a separate fig deb / rpm etc package which would then depend on the docker package.

@tianon, I wonder if we can interest our packagers :)

@albers albers force-pushed the bash-completion branch 2 times, most recently from f689095 to bf6bacc Compare November 20, 2014 12:04
@albers
Copy link
Author

albers commented Nov 20, 2014

Added support for new fig kill option -s

@albers albers force-pushed the bash-completion branch 2 times, most recently from a08f5cf to 3b3c388 Compare November 20, 2014 15:25
@dnephin
Copy link

dnephin commented Dec 2, 2014

LGTM

I think packaging this up in a deb/rpm can wait. Just making it avaiable in contrib for now is nice. I'd really like to replace the pyinstaller packaging with something else for linux.

@albers
Copy link
Author

albers commented Dec 15, 2014

Is there any chance to get this into the next milestone (or merged)?

@SvenDowideit
Copy link

ping @aanand :)

@aanand
Copy link

aanand commented Dec 19, 2014

@albers Still waiting for docs - I don't actually know how to install and test this myself.

@albers albers force-pushed the bash-completion branch 7 times, most recently from 616e889 to 3b0035d Compare December 25, 2014 10:42
@albers
Copy link
Author

albers commented Dec 25, 2014

@aanand As desired, I added documentation about installation and usage. Please review. The wording might need some polishing as I'm not a native speaker. Please let me know.

The download link will have to be adjusted with the next release.

@albers albers force-pushed the bash-completion branch 2 times, most recently from 618242f to e47ff42 Compare December 28, 2014 12:14
@aanand
Copy link

aanand commented Jan 2, 2015

Great stuff. It took me a while to get this working, which I think points to a few documentation refinements:

  • On my Mac, bash completion isn't installed by default; assuming that's universal, we should add a note about installing it. brew install bash-completion worked for me.
  • I had to put the script in /usr/local/etc/bash_completion.d, because of where Homebrew installs stuff, so it should be clear to other brew users that they need to put it there.

I also had two other thoughts:

  • I think we should put the completion installation instructions on the completion page, and just link to it from the Fig installation page.
  • I like the tutorial style, but I think it's safe to assume anyone interested in bash completion will know what it is, so let's structure the page as:
    • Installation instructions
    • List of what types of completions are supported, with short examples of each.

@albers
Copy link
Author

albers commented Jan 7, 2015

@aanand Documentation is adjusted to your suggestions.
After this is merged, completion should be added to #806 #835.

If there is some documentation on how to perform a release, it should be extended so that completion is included in a release and the download link be adjusted.

albers added 2 commits January 8, 2015 15:18
Signed-off-by: Harald Albers <github@albersweb.de>
Signed-off-by: Harald Albers <github@albersweb.de>
@albers
Copy link
Author

albers commented Jan 8, 2015

Added support for new option fig up --no-build

@albers
Copy link
Author

albers commented Jan 12, 2015

@aanand @dnephin I'd like to mention that I'd happily take over the rebranding task for the completion, either in this PR or in a separate one after a merge, so this aspect should not block inclusion in the next milestone or release. Is there anything missing in this PR?

@dnephin
Copy link

dnephin commented Jan 12, 2015

LGTM

@aanand
Copy link

aanand commented Jan 13, 2015

It's looking good. Once the rebrand branch has calmed down, I'll ping you so you can rebase onto it in preparation for release.

@bfirsh
Copy link

bfirsh commented Jan 13, 2015

If this is good, why don't we merge it now before the rename?

@thaJeztah
Copy link
Member

If this is good, why don't we merge it now before the rename?

My thoughts.

Also, iirc a fig stub would be included after the rebranding (so I would still be able to do fig up and it would call machine up in the background)? In that case, completion for fig would still be relevant.

@aanand
Copy link

aanand commented Jan 13, 2015

OK, going to merge and add a TODO to #835.

@aanand
Copy link

aanand commented Jan 13, 2015

LGTM

aanand added a commit that referenced this pull request Jan 13, 2015
Bash completion for fig command
@aanand aanand merged commit 72095f5 into docker:master Jan 13, 2015
@thaJeztah
Copy link
Member

Thanks @aanand! (Lol noticed my s/machine/compose/ typo)

@albers
Copy link
Author

albers commented Jan 13, 2015

Thanks!

Also, iirc a fig stub would be included after the rebranding (so I would still be able to do fig up and it would call compose up in the background)? In that case, completion for fig would still be relevant.

The last line of the completion script registers the completion function _fig for the fig executable. It could as well be registered for both fig and compose.

@albers albers deleted the bash-completion branch January 13, 2015 20:31
@albers
Copy link
Author

albers commented Jan 13, 2015

This closes #338.

@thaJeztah
Copy link
Member

It could as well be registered for both fig and compose.

Ooh, that's nice! Not too familiar with completion scripts, but that's handy :)

Thanks for your contribution!

@sdurrheimer
Copy link

I'm working on a zsh equivalent.

yuval-k pushed a commit to yuval-k/compose that referenced this pull request Apr 10, 2015
Bash completion for fig command
Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
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.

7 participants