bd, jhipster completions#4472
Conversation
Add bd, docker, docker-compose, jhipster completion
Add completion for docker
Add completion for docker-compose
Add completion for jhipster
| - Option completion for `apt list` now works properly (#4350). | ||
| - Added completions for: | ||
| - `as` (#4130) | ||
| - `bd` |
There was a problem hiding this comment.
You can cite the number of this PR. (I understand you'd be hard-pressed to figure it out before submitting!)
There was a problem hiding this comment.
Ah thanks I will add the information.
Add PR id to changes.
| # https://github.com/0rax/fish-bd | ||
| # | ||
|
|
||
| complete -c bd -s c -d "Classic mode : goes back to the first directory named as the string" |
There was a problem hiding this comment.
No space necessary before a colon.
|
|
||
| switch $file_version | ||
| case '1' | ||
| cat $path | command grep '^[a-zA-Z]' | command sed 's/://' |
There was a problem hiding this comment.
Try to use string match and string replace here.
| # 2 spaces. Make it work with any indentation. | ||
| cat $path | command sed -n '/^services:/,/^\w/p' \ | ||
| | command grep "^ [$chars]*:" \ | ||
| | command sed "s/[^$chars]//g" |
There was a problem hiding this comment.
Try to use string match and string replace here.
Remove space in-front of colon.
| complete -c bd -A -f | ||
|
|
||
| function __fish_bd_complete_dirs | ||
| printf (pwd | sed 's|/|\\\n|g') |
There was a problem hiding this comment.
Try to use string replace here, and $PWD instead of the pwd command.
| 'Get the version of a docker-compose.yml file.' | ||
| cat (__fish_docker_compose_file_path) \ | ||
| | command grep '^version:\(\s*\)["\']\?[0-9]["\']\?' \ | ||
| | command grep -o '[0-9]' |
|
Thanks! I found a few things that might be addressed. @faho may be able to give further advice or a thumbs up. |
|
Why are there two PRs for this? |
|
@floam I added changes for 2.7.0 and 3.0.0 I will fix your mentioned issues. |
|
We only need one PR. We'll merge it where necessary. |
Fix mentioned issues
- replace --description with -d - replace grep with string match - replace sed with string replace (expect sed -n)
|
|
||
| function __fish_docker_compose_file_path -d \ | ||
| 'Get the next docker-compose.yml file in the folder parent path.' | ||
| set -l path (pwd) |
|
@floam all requested changes are done. |
Replace pwd command via echo $PWD
| complete -c bd -A -f | ||
|
|
||
| function __fish_bd_complete_dirs | ||
| printf (echo "$PWD" | string replace -a "/" "\n") |
There was a problem hiding this comment.
Can just be: printf $PWD | string replace -a "/" "\n"
Remove parenthesis
|
|
||
| function __fish_bd_complete_dirs | ||
| printf (echo "$PWD" | string replace -a "/" "\n") | ||
| printf echo "$PWD" | string replace -a "/" "\n" |
There was a problem hiding this comment.
This is going to print the word echo.
remove parenthesis and echo command
fix issue inside printf
|
I think it should work now. |
faho
left a comment
There was a problem hiding this comment.
-
Some wording suggestions for jhipster
-
A nit for bd
-
Please remove docker and docker-compose as they are shipped upstream by docker.
| complete -c bd -A -f | ||
|
|
||
| function __fish_bd_complete_dirs | ||
| printf $PWD | string replace -ar "/" "\n" |
There was a problem hiding this comment.
This reads better as string split "/" -- $PWD
| function __fish_prog_needs_command | ||
| set cmd (commandline -opc) | ||
| echo $cmd | ||
| if [ (count $cmd) -eq 1 -a $cmd[1] = 'jhipster' ] |
There was a problem hiding this comment.
Please remove the $cmd[1] = 'jhipster' part - that breaks if you use an alias or any other way of "wrapping" this. It's also completely unnecessary, since fish has already determined that jhipster should be completed.
| complete -f -c jhipster -n '__fish_prog_needs_command' -s V -d 'Output version number' | ||
|
|
||
| # Commands | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a app -d 'Create a new JHipster application based on the selected options.' |
There was a problem hiding this comment.
Just Create a new app? (Note: I know exactly nothing about jhipster)
That it's a JHipster thing is implicit since you're executing jhipster, and that it's based on the selected options oes without saying.
Also, please no trailing ".".
|
|
||
| # Commands | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a app -d 'Create a new JHipster application based on the selected options.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a aws -d 'Deploy the current application to Amazon Web Services.' |
There was a problem hiding this comment.
I'd imagine "AWS" is well-known enough that we can use the acronym.
| # Commands | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a app -d 'Create a new JHipster application based on the selected options.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a aws -d 'Deploy the current application to Amazon Web Services.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a ci-cd -d 'Create pipeline scripts for popular Continuous Integration/Continuous Deployment tools.' |
There was a problem hiding this comment.
No need to say "continuous" twice - Create pipeline scripts for Continuous Integration/Deployment tools?
There was a problem hiding this comment.
Maybe try to shorten further - "continuous integration/deployment tools" - or just "CI tools"?
| complete -f -c jhipster -n '__fish_prog_needs_command' -a app -d 'Create a new JHipster application based on the selected options.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a aws -d 'Deploy the current application to Amazon Web Services.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a ci-cd -d 'Create pipeline scripts for popular Continuous Integration/Continuous Deployment tools.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a client -d 'Create a new JHipster client-side application based on the selected options..' |
| complete -f -c jhipster -n '__fish_prog_needs_command' -a aws -d 'Deploy the current application to Amazon Web Services.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a ci-cd -d 'Create pipeline scripts for popular Continuous Integration/Continuous Deployment tools.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a client -d 'Create a new JHipster client-side application based on the selected options..' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a cloudfoundry -d 'Generate a `deploy/cloudfoundry` folder with a specific manifest.yml to deploy to Cloud Foundry.' |
There was a problem hiding this comment.
Is it necessary to mention manifest.yml here?
I.e. would it be obvious to anyone who knows this tool that this reads manifest.yml?
| complete -f -c jhipster -n '__fish_prog_needs_command' -a rancher-compose -d 'Deploy the current application to Rancher.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a server -d 'Create a new JHipster server-side application.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -r -a service -d 'Create a new Spring service bean.' | ||
| complete -f -c jhipster -n '__fish_prog_needs_command' -a upgrade -d 'Upgrade the JHipster version, and upgrade the generated application.' |
There was a problem hiding this comment.
Upgrade jhipster and the generated app?
|
Completions for both docker and docker-compose are upstream, so we should not ship them. If you have made any improvements to these, please add them there instead of here. |
|
@faho both completions are upstream but not automatically installed on mac and not managed on docker doc. But I can delete them. |
docker.fish and docker-compose.fish were removed.
- Add long version for options in jhipster.fish - Improve bd.fish as mentioned - format jhipster.fish - Improve jihpster.fish as mentioned
| function __fish_prog_needs_command | ||
| set cmd (commandline -opc) | ||
| echo $cmd | ||
| if [ (count $cmd) -eq 1 -a ] |
There was a problem hiding this comment.
-a is for combining with another expression. Since you removed the other part it is doing nothing. It should go.
|
@floam fixed mentioned issue |
|
I'm okay with merging this now, but if we want to have it nice and clean, it's going to need a more complicated merge, and it's gonna be a while before I have enough time to do that. If anyone beats me to it, have at it! |
|
Any reason to not just do a squash merge? |
@ridiculousfish: It's two different completions. I mean it's pretty unlikely that we'd want to revert one of them, but it's a bit unclean. |
Description
Added completions are:
Fixes issue: no issue
TODOs: