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

Clean gulp completions #2137

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ completion/available/gem.completion.bash
completion/available/git.completion.bash
completion/available/github-cli.completion.bash
completion/available/go.completion.bash
completion/available/gulp.completion.bash
completion/available/helm.completion.bash
completion/available/jboss5.completion.bash
completion/available/jboss7.completion.bash
Expand Down
53 changes: 4 additions & 49 deletions completion/available/gulp.completion.bash
Original file line number Diff line number Diff line change
@@ -1,50 +1,5 @@
#!/bin/bash
# Borrowed from grunt-cli
# http://gruntjs.com/
#
# Copyright jQuery Foundation and other contributors, https://jquery.org/
# shellcheck shell=bash

# This software consists of voluntary contributions made by many
# individuals. For exact contribution history, see the revision history
# available at https://github.com/gruntjs/grunt .

# The following license applies to all parts of this software except as
# documented below:

# ====

# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:

# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Usage:
#
# To enable bash <tab> completion for gulp, add the following line (minus the
# leading #, which is the bash comment character) to your ~/.bashrc file:
#
# eval "$(gulp --completion=bash)"
# Enable bash autocompletion.
function _gulp_completions() {
# The currently-being-completed word.
local cur="${COMP_WORDS[COMP_CWORD]}"
#Grab tasks
local compls=$(gulp --tasks-simple)
# Tell complete what stuff to show.
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
}
complete -o default -F _gulp_completions gulp
if _command_exists gulp; then
eval "$(gulp --completion=bash)"
Copy link
Member

Choose a reason for hiding this comment

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

this also does not always work sadly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@NoahGorny It is working

 2022-05-20 08:00:37 ⌚  36f05b99f861 in /my-project
○ → git clone --branch improve/gulp-completion  https://github.com/tbhaxor/bash-it.git ~/.bash_it -q

 2022-05-20 08:00:45 ⌚  36f05b99f861 in /my-project
○ → ~/.bash_it/install.sh 

 2022-05-20 08:00:52 ⌚  36f05b99f861 in /my-project
○ → cat ~/.bash_it/completion/available/gulp.completion.bash 
# shellcheck shell=bash

if _command_exists gulp; then
        eval "$(gulp --completion=bash)"
fi

 2022-05-20 08:01:07 ⌚  36f05b99f861 in /my-project
○ → bashit enable completion gulp
gulp enabled with priority 350.

 2022-05-20 08:01:15 ⌚  36f05b99f861 in /my-project
○ → bashit restart 

 2022-05-20 08:01:21 ⌚  36f05b99f861 in /my-project
○ → gulp 
default  help     todo     

 2022-05-20 08:01:21 ⌚  36f05b99f861 in /my-project
○ → gulp 
default  help     todo     

 2022-05-20 08:01:21 ⌚  36f05b99f861 in /my-project
○ → gulp 
[08:01:40] Using gulpfile /my-project/gulpfile.js
[08:01:40] Starting 'default'...
[08:01:40] Finished 'default' after 2.39 ms

I have tested this in GNU bash, version 5.1.16(1)-release (x86_64-alpine-linux-musl)

fi