Add function tag on functions
Add var protection ( starting ) Add stack trace builder startpull/2209/head
parent
e38696a0ac
commit
1d2687f1f4
|
|
@ -1,36 +1,36 @@
|
||||||
# EditorConfig is awesome: http://EditorConfig.org
|
# EditorConfig is awesome: http://EditorConfig.org
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
|
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
[**.{md,rst}]
|
[**.{md,rst}]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[.git*]
|
[.git*]
|
||||||
indent_size = tab
|
indent_size = tab
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
|
||||||
[{**.*sh,test/run,**.bats}]
|
[{**.*sh,test/run,**.bats}]
|
||||||
indent_size = tab
|
indent_size = tab
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
|
||||||
shell_variant = bash
|
shell_variant = bash
|
||||||
binary_next_line = true # like -bn
|
binary_next_line = true # like -bn
|
||||||
switch_case_indent = true # like -ci
|
switch_case_indent = true # like -ci
|
||||||
space_redirects = true # like -sr
|
space_redirects = true # like -sr
|
||||||
keep_padding = false # like -kp
|
keep_padding = false # like -kp
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
[**.bats]
|
[**.bats]
|
||||||
indent_size = tab
|
indent_size = tab
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
shell_variant = bats
|
shell_variant = bats
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
*.sh text eol=lf
|
*.sh text eol=lf
|
||||||
*.bash text eol=lf
|
*.bash text eol=lf
|
||||||
|
|
||||||
# Docs allow trailing whitespaces
|
# Docs allow trailing whitespaces
|
||||||
*.md whitespace=-blank-at-eol
|
*.md whitespace=-blank-at-eol
|
||||||
*.rst whitespace=-blank-at-eol
|
*.rst whitespace=-blank-at-eol
|
||||||
|
|
||||||
# Windows files
|
# Windows files
|
||||||
*.bat text eol=crlf
|
*.bat text eol=crlf
|
||||||
|
|
|
||||||
|
|
@ -1,85 +1,85 @@
|
||||||
name: 🐛 Bug report
|
name: 🐛 Bug report
|
||||||
title: "[Bug]: "
|
title: "[Bug]: "
|
||||||
description: Create a bug report to help us improve
|
description: Create a bug report to help us improve
|
||||||
labels: "bug:general"
|
labels: "bug:general"
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Expected behavior
|
label: Expected behavior
|
||||||
description: Tell us what should happen.
|
description: Tell us what should happen.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Current behavior
|
label: Current behavior
|
||||||
description: Tell us what happens instead of the expected behavior.
|
description: Tell us what happens instead of the expected behavior.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Possible solution
|
label: Possible solution
|
||||||
description: Tell us how it could be fixed at your glance.
|
description: Tell us how it could be fixed at your glance.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Context
|
label: Context
|
||||||
description: >
|
description: >
|
||||||
How has this issue affected you? What are you trying to accomplish?
|
How has this issue affected you? What are you trying to accomplish?
|
||||||
Providing context helps us come up with a solution that is most useful in the real world.
|
Providing context helps us come up with a solution that is most useful in the real world.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Steps to reproduce
|
label: Steps to reproduce
|
||||||
description: >
|
description: >
|
||||||
Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant.
|
Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Bash-it version
|
label: Bash-it version
|
||||||
placeholder: "How to get: bash-it version"
|
placeholder: "How to get: bash-it version"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: List of enabled plugins, themes and aliases
|
label: List of enabled plugins, themes and aliases
|
||||||
placeholder: "How to get: bash-it show plugins|themes|aliases (it is not a pipe)"
|
placeholder: "How to get: bash-it show plugins|themes|aliases (it is not a pipe)"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Bash version
|
label: Bash version
|
||||||
placeholder: "How to get: bash --version"
|
placeholder: "How to get: bash --version"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Operating system and version
|
label: Operating system and version
|
||||||
placeholder: "How to get: neofetch (or another command)"
|
placeholder: "How to get: neofetch (or another command)"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: "bash-it doctor output"
|
label: "bash-it doctor output"
|
||||||
value: |
|
value: |
|
||||||
```
|
```
|
||||||
# How to get: bash-it doctor
|
# How to get: bash-it doctor
|
||||||
```
|
```
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Your ~/.bashrc
|
label: Your ~/.bashrc
|
||||||
value: |
|
value: |
|
||||||
```bash
|
```bash
|
||||||
# How to get: cat ~/.bashrc
|
# How to get: cat ~/.bashrc
|
||||||
```
|
```
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Notes
|
label: Notes
|
||||||
description: >
|
description: >
|
||||||
Provide any extra details here.
|
Provide any extra details here.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
blank_issues_enabled: true
|
blank_issues_enabled: true
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: Libera chat
|
- name: Libera chat
|
||||||
url: https://web.libera.chat/?channel=#bash-it
|
url: https://web.libera.chat/?channel=#bash-it
|
||||||
about: You can ask and answer questions here
|
about: You can ask and answer questions here
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,34 @@
|
||||||
name: 💡 Feature request
|
name: 💡 Feature request
|
||||||
title: "[Feature]: "
|
title: "[Feature]: "
|
||||||
description: Suggest an idea for this project
|
description: Suggest an idea for this project
|
||||||
labels: "feature request"
|
labels: "feature request"
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Expected behavior
|
label: Expected behavior
|
||||||
description: Tell us how your feature should work.
|
description: Tell us how your feature should work.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Current behavior
|
label: Current behavior
|
||||||
description: Explain the difference your feature will have from current behavior.
|
description: Explain the difference your feature will have from current behavior.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Possible solution
|
label: Possible solution
|
||||||
description: Tell us how it could be fixed at your glance.
|
description: Tell us how it could be fixed at your glance.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Context
|
label: Context
|
||||||
description: >
|
description: >
|
||||||
How has this issue affected you? What are you trying to accomplish?
|
How has this issue affected you? What are you trying to accomplish?
|
||||||
Providing context helps us come up with a solution that is most useful in the real world.
|
Providing context helps us come up with a solution that is most useful in the real world.
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Notes
|
label: Notes
|
||||||
description: >
|
description: >
|
||||||
Provide any extra details here.
|
Provide any extra details here.
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,30 @@
|
||||||
<!--- Provide a general summary of your changes in the Title above -->
|
<!--- Provide a general summary of your changes in the Title above -->
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
<!--- Describe your changes in detail -->
|
<!--- Describe your changes in detail -->
|
||||||
|
|
||||||
## Motivation and Context
|
## Motivation and Context
|
||||||
<!--- Why is this change required? What problem does it solve? -->
|
<!--- Why is this change required? What problem does it solve? -->
|
||||||
<!--- If it fixes an open issue, please link to the issue here. -->
|
<!--- If it fixes an open issue, please link to the issue here. -->
|
||||||
|
|
||||||
## How Has This Been Tested?
|
## How Has This Been Tested?
|
||||||
<!--- Please describe in detail how you tested your changes. -->
|
<!--- Please describe in detail how you tested your changes. -->
|
||||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||||
<!--- see how your change affects other areas of the code, etc. -->
|
<!--- see how your change affects other areas of the code, etc. -->
|
||||||
|
|
||||||
## Screenshots (if appropriate):
|
## Screenshots (if appropriate):
|
||||||
|
|
||||||
## Types of changes
|
## Types of changes
|
||||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
||||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||||
- [ ] New feature (non-breaking change which adds functionality)
|
- [ ] New feature (non-breaking change which adds functionality)
|
||||||
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||||
|
|
||||||
## Checklist:
|
## Checklist:
|
||||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||||
- [ ] My code follows the code style of this project.
|
- [ ] My code follows the code style of this project.
|
||||||
- [ ] If my change requires a change to the documentation, I have updated the documentation accordingly.
|
- [ ] If my change requires a change to the documentation, I have updated the documentation accordingly.
|
||||||
- [ ] I have read the **CONTRIBUTING** document.
|
- [ ] I have read the **CONTRIBUTING** document.
|
||||||
- [ ] If I have added a new file, I also added it to ``clean_files.txt`` and formatted it using ``lint_clean_files.sh``.
|
- [ ] If I have added a new file, I also added it to ``clean_files.txt`` and formatted it using ``lint_clean_files.sh``.
|
||||||
- [ ] I have added tests to cover my changes, and all the new and existing tests pass.
|
- [ ] I have added tests to cover my changes, and all the new and existing tests pass.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
# Configuration for probot-no-response - https://github.com/probot/no-response
|
# Configuration for probot-no-response - https://github.com/probot/no-response
|
||||||
|
|
||||||
# Number of days of inactivity before an Issue is closed for lack of response
|
# Number of days of inactivity before an Issue is closed for lack of response
|
||||||
daysUntilClose: 14
|
daysUntilClose: 14
|
||||||
# Label requiring a response
|
# Label requiring a response
|
||||||
responseRequiredLabel: waiting-for-response
|
responseRequiredLabel: waiting-for-response
|
||||||
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
|
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
|
||||||
closeComment: >
|
closeComment: >
|
||||||
This issue has been automatically closed because there has been no response
|
This issue has been automatically closed because there has been no response
|
||||||
to our request for more information from the original author.
|
to our request for more information from the original author.
|
||||||
You can always reopen the issue if needed.
|
You can always reopen the issue if needed.
|
||||||
|
|
|
||||||
|
|
@ -1,66 +1,66 @@
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
# Triggers the workflow on push or pull request events
|
# Triggers the workflow on push or pull request events
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bats-test:
|
bats-test:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-11]
|
os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-11]
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install greadlink
|
- name: Install greadlink
|
||||||
if: startsWith(runner.os, 'macOS')
|
if: startsWith(runner.os, 'macOS')
|
||||||
run: brew install coreutils
|
run: brew install coreutils
|
||||||
- name: Install parallel
|
- name: Install parallel
|
||||||
if: startsWith(runner.os, 'macOS')
|
if: startsWith(runner.os, 'macOS')
|
||||||
run: brew install parallel
|
run: brew install parallel
|
||||||
- name: Test code
|
- name: Test code
|
||||||
run: test/run
|
run: test/run
|
||||||
|
|
||||||
build-docs:
|
build-docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
- name: Install docs dependencies
|
- name: Install docs dependencies
|
||||||
run: python3 -m pip install -r docs/requirements.txt
|
run: python3 -m pip install -r docs/requirements.txt
|
||||||
- name: Build the docs
|
- name: Build the docs
|
||||||
run: sphinx-build -W -b html docs docs/_build/html
|
run: sphinx-build -W -b html docs docs/_build/html
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.17
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
# - name: Update APT Package Lists
|
# - name: Update APT Package Lists
|
||||||
# run: sudo apt-get update
|
# run: sudo apt-get update
|
||||||
- name: Install shfmt
|
- name: Install shfmt
|
||||||
run: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
|
run: GO111MODULE=on go get mvdan.cc/sh/v3/cmd/shfmt
|
||||||
- name: Install shellcheck
|
- name: Install shellcheck
|
||||||
env:
|
env:
|
||||||
scversion: stable # Or latest, vxx, etc
|
scversion: stable # Or latest, vxx, etc
|
||||||
run: |
|
run: |
|
||||||
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv "shellcheck-${scversion}/shellcheck"
|
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv "shellcheck-${scversion}/shellcheck"
|
||||||
sudo cp "shellcheck-${scversion}/shellcheck" /usr/bin/
|
sudo cp "shellcheck-${scversion}/shellcheck" /usr/bin/
|
||||||
shellcheck --version
|
shellcheck --version
|
||||||
- name: Install pre-commit
|
- name: Install pre-commit
|
||||||
run: python3 -m pip install -r test/lint-requirements.txt
|
run: python3 -m pip install -r test/lint-requirements.txt
|
||||||
- name: Run lint
|
- name: Run lint
|
||||||
run: ./lint_clean_files.sh
|
run: ./lint_clean_files.sh
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
.atom-build.json
|
.atom-build.json
|
||||||
*/enabled/*
|
*/enabled/*
|
||||||
.DS_Store
|
.DS_Store
|
||||||
custom/*
|
custom/*
|
||||||
!custom/example.bash
|
!custom/example.bash
|
||||||
.rvmrc
|
.rvmrc
|
||||||
aliases/custom.aliases.bash
|
aliases/custom.aliases.bash
|
||||||
completion/custom.completion.bash
|
completion/custom.completion.bash
|
||||||
lib/custom.bash
|
lib/custom.bash
|
||||||
plugins/custom.plugins.bash
|
plugins/custom.plugins.bash
|
||||||
*.swp
|
*.swp
|
||||||
.*.un~
|
.*.un~
|
||||||
bats
|
bats
|
||||||
.idea
|
.idea
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
*.sublime-project
|
*.sublime-project
|
||||||
enabled/*
|
enabled/*
|
||||||
/enabled
|
/enabled
|
||||||
tmp/
|
tmp/
|
||||||
|
|
||||||
# Do not save profiles
|
# Do not save profiles
|
||||||
profiles/*
|
profiles/*
|
||||||
# apart from the default one
|
# apart from the default one
|
||||||
!profiles/default.bash_it
|
!profiles/default.bash_it
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
[submodule "test_lib/bats-core"]
|
[submodule "test_lib/bats-core"]
|
||||||
path = test_lib/bats-core
|
path = test_lib/bats-core
|
||||||
url = https://github.com/bats-core/bats-core
|
url = https://github.com/bats-core/bats-core
|
||||||
branch = tags/v1.2.0
|
branch = tags/v1.2.0
|
||||||
[submodule "test_lib/bats-support"]
|
[submodule "test_lib/bats-support"]
|
||||||
path = test_lib/bats-support
|
path = test_lib/bats-support
|
||||||
url = https://github.com/bats-core/bats-support
|
url = https://github.com/bats-core/bats-support
|
||||||
branch = tags/v0.3.0
|
branch = tags/v0.3.0
|
||||||
[submodule "test_lib/bats-assert"]
|
[submodule "test_lib/bats-assert"]
|
||||||
path = test_lib/bats-assert
|
path = test_lib/bats-assert
|
||||||
url = https://github.com/bats-core/bats-assert
|
url = https://github.com/bats-core/bats-assert
|
||||||
branch = tags/v2.0.0
|
branch = tags/v2.0.0
|
||||||
[submodule "test_lib/bats-file"]
|
[submodule "test_lib/bats-file"]
|
||||||
path = test_lib/bats-file
|
path = test_lib/bats-file
|
||||||
url = https://github.com/bats-core/bats-file
|
url = https://github.com/bats-core/bats-file
|
||||||
branch = tags/v0.3.0
|
branch = tags/v0.3.0
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,50 @@
|
||||||
# See https://pre-commit.com for more information
|
# See https://pre-commit.com for more information
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
---
|
---
|
||||||
# fail_fast: true
|
# fail_fast: true
|
||||||
minimum_pre_commit_version: 1.18.1
|
minimum_pre_commit_version: 1.18.1
|
||||||
exclude: "docs/_build/"
|
exclude: "docs/_build/"
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v2.3.0
|
rev: v2.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
exclude: ".(md|rst)$"
|
exclude: ".(md|rst)$"
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
||||||
rev: 2.1.5
|
rev: 2.1.5
|
||||||
hooks:
|
hooks:
|
||||||
- id: git-check # Configure in .gitattributes
|
- id: git-check # Configure in .gitattributes
|
||||||
- id: shellcheck
|
- id: shellcheck
|
||||||
exclude: ".bats$"
|
exclude: ".bats$"
|
||||||
- id: shfmt
|
- id: shfmt
|
||||||
exclude: ".bats$"
|
exclude: ".bats$"
|
||||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||||
rev: v1.1.7
|
rev: v1.1.7
|
||||||
hooks:
|
hooks:
|
||||||
# - id: forbid-crlf
|
# - id: forbid-crlf
|
||||||
- id: remove-crlf
|
- id: remove-crlf
|
||||||
exclude: ".bat$"
|
exclude: ".bat$"
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: dot-sh
|
- id: dot-sh
|
||||||
name: Check .sh files against bash-it requirements
|
name: Check .sh files against bash-it requirements
|
||||||
entry: ./hooks/dot-sh.sh
|
entry: ./hooks/dot-sh.sh
|
||||||
language: system
|
language: system
|
||||||
files: "\\.sh$"
|
files: "\\.sh$"
|
||||||
types: [file]
|
types: [file]
|
||||||
- id: dot-bash
|
- id: dot-bash
|
||||||
name: Check .bash files against bash-it requirements
|
name: Check .bash files against bash-it requirements
|
||||||
exclude: "test/test_helper.bash"
|
exclude: "test/test_helper.bash"
|
||||||
entry: ./hooks/dot-bash.sh
|
entry: ./hooks/dot-bash.sh
|
||||||
language: system
|
language: system
|
||||||
files: "\\.bash$"
|
files: "\\.bash$"
|
||||||
types: [file]
|
types: [file]
|
||||||
- id: clean-files-txt
|
- id: clean-files-txt
|
||||||
name: Check that clean_files.txt is sorted alphabetically.
|
name: Check that clean_files.txt is sorted alphabetically.
|
||||||
entry: ./hooks/check-clean-files-txt.sh
|
entry: ./hooks/check-clean-files-txt.sh
|
||||||
language: system
|
language: system
|
||||||
files: clean_files.txt
|
files: clean_files.txt
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
version: 2
|
version: 2
|
||||||
|
|
||||||
sphinx:
|
sphinx:
|
||||||
builder: htmldir
|
builder: htmldir
|
||||||
configuration: docs/conf.py
|
configuration: docs/conf.py
|
||||||
|
|
||||||
python:
|
python:
|
||||||
version: 3.7
|
version: 3.7
|
||||||
install:
|
install:
|
||||||
- requirements: docs/requirements.txt
|
- requirements: docs/requirements.txt
|
||||||
|
|
|
||||||
42
LICENSE
42
LICENSE
|
|
@ -1,21 +1,21 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020-2021 Bash-it
|
Copyright (c) 2020-2021 Bash-it
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,15 @@ cite 'about-alias'
|
||||||
about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.'
|
about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.'
|
||||||
|
|
||||||
# set apt aliases
|
# set apt aliases
|
||||||
function _set_pkg_aliases() {
|
function _set_pkg_aliases()
|
||||||
if _command_exists apt; then
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
|
if _command_exists apt
|
||||||
|
then
|
||||||
alias apts='apt-cache search'
|
alias apts='apt-cache search'
|
||||||
alias aptshow='apt-cache show'
|
alias aptshow='apt-cache show'
|
||||||
alias aptinst='sudo apt-get install -V'
|
alias aptinst='sudo apt-get install -V'
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,15 @@
|
||||||
about-alias 'Curl aliases for convenience.'
|
about-alias 'Curl aliases for convenience.'
|
||||||
|
|
||||||
# set apt aliases
|
# set apt aliases
|
||||||
function _set_pkg_aliases() {
|
function _set_pkg_aliases()
|
||||||
if _command_exists curl; then
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
|
if _command_exists curl
|
||||||
|
then
|
||||||
# follow redirects
|
# follow redirects
|
||||||
alias cl='curl -L'
|
alias cl='curl -L'
|
||||||
# follow redirects, download as original name
|
# follow redirects, download as original name
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ case $OSTYPE in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if _bash-it-component-item-is-enabled plugin docker; then
|
if _bash-it-component-item-is-enabled plugin docker
|
||||||
|
then
|
||||||
# Function aliases from docker plugin:
|
# Function aliases from docker plugin:
|
||||||
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
|
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
|
||||||
alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers
|
alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
about-alias 'fuck/please to retry last command with sudo'
|
about-alias 'fuck/please to retry last command with sudo'
|
||||||
|
|
||||||
# Play nicely with 'thefuck' plugin
|
# Play nicely with 'thefuck' plugin
|
||||||
if ! _command_exists fuck; then
|
if ! _command_exists fuck
|
||||||
|
then
|
||||||
alias fuck='sudo $(fc -ln -1)'
|
alias fuck='sudo $(fc -ln -1)'
|
||||||
fi
|
fi
|
||||||
alias please=fuck
|
alias please=fuck
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
about-alias 'general aliases'
|
about-alias 'general aliases'
|
||||||
|
|
||||||
if command ls --color -d . &> /dev/null; then
|
if command ls --color -d . &> /dev/null
|
||||||
|
then
|
||||||
alias ls='ls --color=auto'
|
alias ls='ls --color=auto'
|
||||||
# BSD `ls` doesn't need an argument (`-G`) when `$CLICOLOR` is set.
|
# BSD `ls` doesn't need an argument (`-G`) when `$CLICOLOR` is set.
|
||||||
fi
|
fi
|
||||||
|
|
@ -23,11 +24,13 @@ alias vbpf='${VISUAL:-vim} ~/.bash_profile'
|
||||||
# colored grep
|
# colored grep
|
||||||
# Need to check an existing file for a pattern that will be found to ensure
|
# Need to check an existing file for a pattern that will be found to ensure
|
||||||
# that the check works when on an OS that supports the color option
|
# that the check works when on an OS that supports the color option
|
||||||
if command grep --color=auto "a" "${BASH_IT?}"/*.md &> /dev/null; then
|
if command grep --color=auto "a" "${BASH_IT?}"/*.md &> /dev/null
|
||||||
|
then
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if _command_exists gshuf; then
|
if _command_exists gshuf
|
||||||
|
then
|
||||||
alias shuf=gshuf
|
alias shuf=gshuf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -60,7 +63,8 @@ alias -- -='cd -' # Go back
|
||||||
alias h='history'
|
alias h='history'
|
||||||
|
|
||||||
# Tree
|
# Tree
|
||||||
if ! _command_exists tree; then
|
if ! _command_exists tree
|
||||||
|
then
|
||||||
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
|
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -72,9 +76,16 @@ alias rd='rmdir'
|
||||||
alias xt='extract'
|
alias xt='extract'
|
||||||
|
|
||||||
# Display whatever file is regular file or folder
|
# Display whatever file is regular file or folder
|
||||||
function catt() {
|
function catt()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
if [[ -d "$i" ]]; then
|
if [[ -d "$i" ]]
|
||||||
|
then
|
||||||
ls "$i"
|
ls "$i"
|
||||||
else
|
else
|
||||||
cat "$i"
|
cat "$i"
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,8 @@ alias ggui='git gui'
|
||||||
# home
|
# home
|
||||||
alias ghm='cd "$(git rev-parse --show-toplevel)"' # Git home
|
alias ghm='cd "$(git rev-parse --show-toplevel)"' # Git home
|
||||||
# appendage to ghm
|
# appendage to ghm
|
||||||
if ! _command_exists gh; then
|
if ! _command_exists gh
|
||||||
|
then
|
||||||
alias gh='ghm'
|
alias gh='ghm'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -199,12 +200,25 @@ case $OSTYPE in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
function gdv() {
|
function gdv()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
git diff --ignore-all-space "$@" | vim -R -
|
git diff --ignore-all-space "$@" | vim -R -
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_default_branch() {
|
function get_default_branch()
|
||||||
if git branch | grep -q '^. main\s*$'; then
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
|
if git branch | grep -q '^. main\s*$'
|
||||||
|
then
|
||||||
echo main
|
echo main
|
||||||
else
|
else
|
||||||
echo master
|
echo master
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
about-alias 'kubectl aliases'
|
about-alias 'kubectl aliases'
|
||||||
|
|
||||||
if _command_exists kubectl; then
|
if _command_exists kubectl
|
||||||
|
then
|
||||||
alias kc='kubectl'
|
alias kc='kubectl'
|
||||||
alias kcgp='kubectl get pods'
|
alias kcgp='kubectl get pods'
|
||||||
alias kcgd='kubectl get deployments'
|
alias kcgd='kubectl get deployments'
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ alias skype='open -a Skype'
|
||||||
alias mou='open -a Mou'
|
alias mou='open -a Mou'
|
||||||
alias subl='open -a "Sublime Text"'
|
alias subl='open -a "Sublime Text"'
|
||||||
|
|
||||||
if [[ -s /usr/bin/firefox ]]; then
|
if [[ -s /usr/bin/firefox ]]
|
||||||
|
then
|
||||||
unalias firefox
|
unalias firefox
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
about-alias 'uuidgen aliases'
|
about-alias 'uuidgen aliases'
|
||||||
|
|
||||||
if _command_exists uuid; then # Linux
|
if _command_exists uuid
|
||||||
|
then # Linux
|
||||||
alias uuidu="uuid | tr '[:lower:]' '[:upper:]'"
|
alias uuidu="uuid | tr '[:lower:]' '[:upper:]'"
|
||||||
alias uuidl=uuid
|
alias uuidl=uuid
|
||||||
elif _command_exists uuidgen; then # macOS/BSD
|
elif _command_exists uuidgen
|
||||||
|
then # macOS/BSD
|
||||||
alias uuidu="uuidgen"
|
alias uuidu="uuidgen"
|
||||||
alias uuid="uuidgen | tr '[:upper:]' '[:lower:]'" # because upper case is like YELLING
|
alias uuid="uuidgen | tr '[:upper:]' '[:lower:]'" # because upper case is like YELLING
|
||||||
alias uuidl=uuid
|
alias uuidl=uuid
|
||||||
|
|
|
||||||
21
bash_it.sh
21
bash_it.sh
|
|
@ -45,7 +45,8 @@ done
|
||||||
|
|
||||||
# Load theme, if a theme was set
|
# Load theme, if a theme was set
|
||||||
# shellcheck source-path=SCRIPTDIR/themes
|
# shellcheck source-path=SCRIPTDIR/themes
|
||||||
if [[ -n "${BASH_IT_THEME:-}" ]]; then
|
if [[ -n "${BASH_IT_THEME:-}" ]]
|
||||||
|
then
|
||||||
_log_debug "Loading theme '${BASH_IT_THEME}'."
|
_log_debug "Loading theme '${BASH_IT_THEME}'."
|
||||||
BASH_IT_LOG_PREFIX="themes: githelpers: "
|
BASH_IT_LOG_PREFIX="themes: githelpers: "
|
||||||
source "${BASH_IT}/themes/githelpers.theme.bash"
|
source "${BASH_IT}/themes/githelpers.theme.bash"
|
||||||
|
|
@ -64,7 +65,8 @@ fi
|
||||||
_log_debug "Loading custom aliases, completion, plugins..."
|
_log_debug "Loading custom aliases, completion, plugins..."
|
||||||
for _bash_it_main_file_type in "aliases" "completion" "plugins"; do
|
for _bash_it_main_file_type in "aliases" "completion" "plugins"; do
|
||||||
_bash_it_main_file_custom="${BASH_IT}/${_bash_it_main_file_type}/custom.${_bash_it_main_file_type}.bash"
|
_bash_it_main_file_custom="${BASH_IT}/${_bash_it_main_file_type}/custom.${_bash_it_main_file_type}.bash"
|
||||||
if [[ -s "${_bash_it_main_file_custom}" ]]; then
|
if [[ -s "${_bash_it_main_file_custom}" ]]
|
||||||
|
then
|
||||||
_bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
|
_bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
|
||||||
_log_debug "Loading component..."
|
_log_debug "Loading component..."
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
|
|
@ -76,7 +78,8 @@ done
|
||||||
# Custom
|
# Custom
|
||||||
_log_debug "Loading general custom files..."
|
_log_debug "Loading general custom files..."
|
||||||
for _bash_it_main_file_custom in "${BASH_IT_CUSTOM}"/*.bash "${BASH_IT_CUSTOM}"/*/*.bash; do
|
for _bash_it_main_file_custom in "${BASH_IT_CUSTOM}"/*.bash "${BASH_IT_CUSTOM}"/*/*.bash; do
|
||||||
if [[ -s "${_bash_it_main_file_custom}" ]]; then
|
if [[ -s "${_bash_it_main_file_custom}" ]]
|
||||||
|
then
|
||||||
_bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
|
_bash-it-log-prefix-by-path "${_bash_it_main_file_custom}"
|
||||||
_log_debug "Loading custom file..."
|
_log_debug "Loading custom file..."
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
|
|
@ -85,21 +88,25 @@ for _bash_it_main_file_custom in "${BASH_IT_CUSTOM}"/*.bash "${BASH_IT_CUSTOM}"/
|
||||||
BASH_IT_LOG_PREFIX="core: main: "
|
BASH_IT_LOG_PREFIX="core: main: "
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "${PROMPT:-}" ]]; then
|
if [[ -n "${PROMPT:-}" ]]
|
||||||
|
then
|
||||||
PS1="${PROMPT}"
|
PS1="${PROMPT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Adding Support for other OSes
|
# Adding Support for other OSes
|
||||||
if _command_exists gloobus-preview; then
|
if _command_exists gloobus-preview
|
||||||
|
then
|
||||||
PREVIEW="gloobus-preview"
|
PREVIEW="gloobus-preview"
|
||||||
elif [[ -d /Applications/Preview.app ]]; then
|
elif [[ -d /Applications/Preview.app ]]
|
||||||
|
then
|
||||||
PREVIEW="/Applications/Preview.app"
|
PREVIEW="/Applications/Preview.app"
|
||||||
else
|
else
|
||||||
PREVIEW="less"
|
PREVIEW="less"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# BASH_IT_RELOAD_LEGACY is set.
|
# BASH_IT_RELOAD_LEGACY is set.
|
||||||
if [[ -n "${BASH_IT_RELOAD_LEGACY:-}" ]] && ! _command_exists reload; then
|
if [[ -n "${BASH_IT_RELOAD_LEGACY:-}" ]] && ! _command_exists reload
|
||||||
|
then
|
||||||
# shellcheck disable=SC2139
|
# shellcheck disable=SC2139
|
||||||
alias reload="builtin source '${BASH_IT_BASHRC?}'"
|
alias reload="builtin source '${BASH_IT_BASHRC?}'"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
352
clean_files.txt
352
clean_files.txt
|
|
@ -1,176 +1,176 @@
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Allow-list of files to be lint-checked by CI
|
# Allow-list of files to be lint-checked by CI
|
||||||
#
|
#
|
||||||
# Directory Support
|
# Directory Support
|
||||||
# Directory references are allowed within the file, ie:
|
# Directory references are allowed within the file, ie:
|
||||||
#
|
#
|
||||||
# themes/powerline
|
# themes/powerline
|
||||||
#
|
#
|
||||||
# All files under the referenced directory will be checked
|
# All files under the referenced directory will be checked
|
||||||
#
|
#
|
||||||
# Checking Files Locally
|
# Checking Files Locally
|
||||||
# You can manually invoke the check via:
|
# You can manually invoke the check via:
|
||||||
#
|
#
|
||||||
# lint_clean_files.sh
|
# lint_clean_files.sh
|
||||||
#
|
#
|
||||||
|
|
||||||
# root directories
|
# root directories
|
||||||
#
|
#
|
||||||
aliases/
|
aliases/
|
||||||
docs/
|
docs/
|
||||||
hooks/
|
hooks/
|
||||||
scripts/
|
scripts/
|
||||||
|
|
||||||
# root files
|
# root files
|
||||||
#
|
#
|
||||||
.gitattributes
|
.gitattributes
|
||||||
bash_it.sh
|
bash_it.sh
|
||||||
clean_files.txt
|
clean_files.txt
|
||||||
install.sh
|
install.sh
|
||||||
lint_clean_files.sh
|
lint_clean_files.sh
|
||||||
|
|
||||||
# completions
|
# completions
|
||||||
#
|
#
|
||||||
completion/available/apm.completion.bash
|
completion/available/apm.completion.bash
|
||||||
completion/available/awless.completion.bash
|
completion/available/awless.completion.bash
|
||||||
completion/available/awscli.completion.bash
|
completion/available/awscli.completion.bash
|
||||||
completion/available/bash-it.completion.bash
|
completion/available/bash-it.completion.bash
|
||||||
completion/available/brew.completion.bash
|
completion/available/brew.completion.bash
|
||||||
completion/available/cargo.completion.bash
|
completion/available/cargo.completion.bash
|
||||||
completion/available/composer.completion.bash
|
completion/available/composer.completion.bash
|
||||||
completion/available/conda.completion.bash
|
completion/available/conda.completion.bash
|
||||||
completion/available/consul.completion.bash
|
completion/available/consul.completion.bash
|
||||||
completion/available/dart.completion.bash
|
completion/available/dart.completion.bash
|
||||||
completion/available/django.completion.bash
|
completion/available/django.completion.bash
|
||||||
completion/available/dmidecode.completion.bash
|
completion/available/dmidecode.completion.bash
|
||||||
completion/available/docker-machine.completion.bash
|
completion/available/docker-machine.completion.bash
|
||||||
completion/available/docker.completion.bash
|
completion/available/docker.completion.bash
|
||||||
completion/available/dotnet.completion.bash
|
completion/available/dotnet.completion.bash
|
||||||
completion/available/flutter.completion.bash
|
completion/available/flutter.completion.bash
|
||||||
completion/available/gcloud.completion.bash
|
completion/available/gcloud.completion.bash
|
||||||
completion/available/gem.completion.bash
|
completion/available/gem.completion.bash
|
||||||
completion/available/git.completion.bash
|
completion/available/git.completion.bash
|
||||||
completion/available/github-cli.completion.bash
|
completion/available/github-cli.completion.bash
|
||||||
completion/available/go.completion.bash
|
completion/available/go.completion.bash
|
||||||
completion/available/helm.completion.bash
|
completion/available/helm.completion.bash
|
||||||
completion/available/jboss5.completion.bash
|
completion/available/jboss5.completion.bash
|
||||||
completion/available/jboss7.completion.bash
|
completion/available/jboss7.completion.bash
|
||||||
completion/available/jungle.completion.bash
|
completion/available/jungle.completion.bash
|
||||||
completion/available/knife.completion.bash
|
completion/available/knife.completion.bash
|
||||||
completion/available/kontena.completion.bash
|
completion/available/kontena.completion.bash
|
||||||
completion/available/kubectl.completion.bash
|
completion/available/kubectl.completion.bash
|
||||||
completion/available/laravel.completion.bash
|
completion/available/laravel.completion.bash
|
||||||
completion/available/lerna.completion.bash
|
completion/available/lerna.completion.bash
|
||||||
completion/available/minikube.completion.bash
|
completion/available/minikube.completion.bash
|
||||||
completion/available/ngrok.completion.bash
|
completion/available/ngrok.completion.bash
|
||||||
completion/available/notify-send.completion.bash
|
completion/available/notify-send.completion.bash
|
||||||
completion/available/npm.completion.bash
|
completion/available/npm.completion.bash
|
||||||
completion/available/packer.completion.bash
|
completion/available/packer.completion.bash
|
||||||
completion/available/pip.completion.bash
|
completion/available/pip.completion.bash
|
||||||
completion/available/pip3.completion.bash
|
completion/available/pip3.completion.bash
|
||||||
completion/available/pipenv.completion.bash
|
completion/available/pipenv.completion.bash
|
||||||
completion/available/pipx.completion.bash
|
completion/available/pipx.completion.bash
|
||||||
completion/available/rustup.completion.bash
|
completion/available/rustup.completion.bash
|
||||||
completion/available/sdkman.completion.bash
|
completion/available/sdkman.completion.bash
|
||||||
completion/available/system.completion.bash
|
completion/available/system.completion.bash
|
||||||
completion/available/vault.completion.bash
|
completion/available/vault.completion.bash
|
||||||
completion/available/vuejs.completion.bash
|
completion/available/vuejs.completion.bash
|
||||||
completion/available/wpscan.completion.bash
|
completion/available/wpscan.completion.bash
|
||||||
completion/available/yarn.completion.bash
|
completion/available/yarn.completion.bash
|
||||||
|
|
||||||
# libraries
|
# libraries
|
||||||
lib/appearance.bash
|
lib/appearance.bash
|
||||||
lib/colors.bash
|
lib/colors.bash
|
||||||
lib/command_duration.bash
|
lib/command_duration.bash
|
||||||
lib/helpers.bash
|
lib/helpers.bash
|
||||||
lib/history.bash
|
lib/history.bash
|
||||||
lib/log.bash
|
lib/log.bash
|
||||||
lib/preexec.bash
|
lib/preexec.bash
|
||||||
lib/preview.bash
|
lib/preview.bash
|
||||||
lib/search.bash
|
lib/search.bash
|
||||||
lib/utilities.bash
|
lib/utilities.bash
|
||||||
|
|
||||||
# plugins
|
# plugins
|
||||||
#
|
#
|
||||||
plugins/available/alias-completion.plugin.bash
|
plugins/available/alias-completion.plugin.bash
|
||||||
plugins/available/autojump.plugin.bash
|
plugins/available/autojump.plugin.bash
|
||||||
plugins/available/base.plugin.bash
|
plugins/available/base.plugin.bash
|
||||||
plugins/available/basher.plugin.bash
|
plugins/available/basher.plugin.bash
|
||||||
plugins/available/battery.plugin.bash
|
plugins/available/battery.plugin.bash
|
||||||
plugins/available/blesh.plugin.bash
|
plugins/available/blesh.plugin.bash
|
||||||
plugins/available/cmd-returned-notify.plugin.bash
|
plugins/available/cmd-returned-notify.plugin.bash
|
||||||
plugins/available/colors.plugin.bash
|
plugins/available/colors.plugin.bash
|
||||||
plugins/available/direnv.plugin.bash
|
plugins/available/direnv.plugin.bash
|
||||||
plugins/available/dirs.plugin.bash
|
plugins/available/dirs.plugin.bash
|
||||||
plugins/available/docker-machine.plugin.bash
|
plugins/available/docker-machine.plugin.bash
|
||||||
plugins/available/gif.plugin.bash
|
plugins/available/gif.plugin.bash
|
||||||
plugins/available/git-subrepo.plugin.bash
|
plugins/available/git-subrepo.plugin.bash
|
||||||
plugins/available/git.plugin.bash
|
plugins/available/git.plugin.bash
|
||||||
plugins/available/go.plugin.bash
|
plugins/available/go.plugin.bash
|
||||||
plugins/available/goenv.plugin.bash
|
plugins/available/goenv.plugin.bash
|
||||||
plugins/available/history-eternal.plugin.bash
|
plugins/available/history-eternal.plugin.bash
|
||||||
plugins/available/history-search.plugin.bash
|
plugins/available/history-search.plugin.bash
|
||||||
plugins/available/history-substring-search.plugin.bash
|
plugins/available/history-substring-search.plugin.bash
|
||||||
plugins/available/history.plugin.bash
|
plugins/available/history.plugin.bash
|
||||||
plugins/available/hub.plugin.bash
|
plugins/available/hub.plugin.bash
|
||||||
plugins/available/java.plugin.bash
|
plugins/available/java.plugin.bash
|
||||||
plugins/available/jekyll.plugin.bash
|
plugins/available/jekyll.plugin.bash
|
||||||
plugins/available/jump.plugin.bash
|
plugins/available/jump.plugin.bash
|
||||||
plugins/available/latex.plugin.bash
|
plugins/available/latex.plugin.bash
|
||||||
plugins/available/less-pretty-cat.plugin.bash
|
plugins/available/less-pretty-cat.plugin.bash
|
||||||
plugins/available/man.plugin.bash
|
plugins/available/man.plugin.bash
|
||||||
plugins/available/nginx.plugin.bash
|
plugins/available/nginx.plugin.bash
|
||||||
plugins/available/node.plugin.bash
|
plugins/available/node.plugin.bash
|
||||||
plugins/available/nodenv.plugin.bash
|
plugins/available/nodenv.plugin.bash
|
||||||
plugins/available/osx-timemachine.plugin.bash
|
plugins/available/osx-timemachine.plugin.bash
|
||||||
plugins/available/osx.plugin.bash
|
plugins/available/osx.plugin.bash
|
||||||
plugins/available/percol.plugin.bash
|
plugins/available/percol.plugin.bash
|
||||||
plugins/available/plenv.plugin.bash
|
plugins/available/plenv.plugin.bash
|
||||||
plugins/available/projects.plugin.bash
|
plugins/available/projects.plugin.bash
|
||||||
plugins/available/proxy.plugin.bash
|
plugins/available/proxy.plugin.bash
|
||||||
plugins/available/pyenv.plugin.bash
|
plugins/available/pyenv.plugin.bash
|
||||||
plugins/available/python.plugin.bash
|
plugins/available/python.plugin.bash
|
||||||
plugins/available/rbenv.plugin.bash
|
plugins/available/rbenv.plugin.bash
|
||||||
plugins/available/ruby.plugin.bash
|
plugins/available/ruby.plugin.bash
|
||||||
plugins/available/textmate.plugin.bash
|
plugins/available/textmate.plugin.bash
|
||||||
plugins/available/todo.plugin.bash
|
plugins/available/todo.plugin.bash
|
||||||
plugins/available/xterm.plugin.bash
|
plugins/available/xterm.plugin.bash
|
||||||
plugins/available/zoxide.plugin.bash
|
plugins/available/zoxide.plugin.bash
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
#
|
#
|
||||||
test/completion/aliases.completion.bats
|
test/completion/aliases.completion.bats
|
||||||
test/run
|
test/run
|
||||||
test/test_helper.bash
|
test/test_helper.bash
|
||||||
|
|
||||||
# themes
|
# themes
|
||||||
#
|
#
|
||||||
themes/90210
|
themes/90210
|
||||||
themes/agnoster
|
themes/agnoster
|
||||||
themes/atomic
|
themes/atomic
|
||||||
themes/axin
|
themes/axin
|
||||||
themes/bakke
|
themes/bakke
|
||||||
themes/barbuk
|
themes/barbuk
|
||||||
themes/base.theme.bash
|
themes/base.theme.bash
|
||||||
themes/binaryanomaly
|
themes/binaryanomaly
|
||||||
themes/bira
|
themes/bira
|
||||||
themes/bobby
|
themes/bobby
|
||||||
themes/bobby-python
|
themes/bobby-python
|
||||||
themes/brainy
|
themes/brainy
|
||||||
themes/brunton
|
themes/brunton
|
||||||
themes/candy
|
themes/candy
|
||||||
themes/easy
|
themes/easy
|
||||||
themes/essential
|
themes/essential
|
||||||
themes/githelpers.theme.bash
|
themes/githelpers.theme.bash
|
||||||
themes/modern
|
themes/modern
|
||||||
themes/norbu
|
themes/norbu
|
||||||
themes/oh-my-posh
|
themes/oh-my-posh
|
||||||
themes/p4helpers.theme.bash
|
themes/p4helpers.theme.bash
|
||||||
themes/pete
|
themes/pete
|
||||||
themes/powerline
|
themes/powerline
|
||||||
themes/pure
|
themes/pure
|
||||||
themes/purity
|
themes/purity
|
||||||
|
|
||||||
# vendor init files
|
# vendor init files
|
||||||
#
|
#
|
||||||
vendor/.gitattributes
|
vendor/.gitattributes
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,12 @@ about-plugin 'Automatic completion of aliases'
|
||||||
# http://stackoverflow.com/a/1793178/1228454
|
# http://stackoverflow.com/a/1793178/1228454
|
||||||
|
|
||||||
# Automatically add completion for all aliases to commands having completion functions
|
# Automatically add completion for all aliases to commands having completion functions
|
||||||
function _bash-it-component-completion-callback-on-init-aliases() {
|
function _bash-it-component-completion-callback-on-init-aliases()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local namespace="alias_completion"
|
local namespace="alias_completion"
|
||||||
local tmp_file completion_loader alias_name line completions chars
|
local tmp_file completion_loader alias_name line completions chars
|
||||||
local alias_arg_words new_completion compl_func compl_wrapper alias_defn
|
local alias_arg_words new_completion compl_func compl_wrapper alias_defn
|
||||||
|
|
@ -27,7 +32,8 @@ function _bash-it-component-completion-callback-on-init-aliases() {
|
||||||
tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1
|
tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1
|
||||||
|
|
||||||
IFS=$'\n' read -r completion_loader < <(complete -p -D 2> /dev/null)
|
IFS=$'\n' read -r completion_loader < <(complete -p -D 2> /dev/null)
|
||||||
if [[ "${completion_loader#complete }" =~ '-F'[[:space:]]([[:alnum:]_]+)[[:space:]] ]]; then
|
if [[ "${completion_loader#complete }" =~ '-F'[[:space:]]([[:alnum:]_]+)[[:space:]] ]]
|
||||||
|
then
|
||||||
completion_loader="${BASH_REMATCH[1]}"
|
completion_loader="${BASH_REMATCH[1]}"
|
||||||
else
|
else
|
||||||
completion_loader=""
|
completion_loader=""
|
||||||
|
|
@ -43,7 +49,8 @@ function _bash-it-component-completion-callback-on-init-aliases() {
|
||||||
alias_defn="${line#*=\'}" # alias definition
|
alias_defn="${line#*=\'}" # alias definition
|
||||||
alias_defn="${alias_defn%\'}"
|
alias_defn="${alias_defn%\'}"
|
||||||
alias_cmd="${alias_defn%%[[:space:]]*}" # first word of alias
|
alias_cmd="${alias_defn%%[[:space:]]*}" # first word of alias
|
||||||
if [[ ${alias_defn} == ${alias_cmd} ]]; then
|
if [[ ${alias_defn} == ${alias_cmd} ]]
|
||||||
|
then
|
||||||
alias_args=''
|
alias_args=''
|
||||||
else
|
else
|
||||||
alias_args="${alias_defn#*[[:space:]]}" # everything after first word
|
alias_args="${alias_defn#*[[:space:]]}" # everything after first word
|
||||||
|
|
@ -51,15 +58,18 @@ function _bash-it-component-completion-callback-on-init-aliases() {
|
||||||
|
|
||||||
# skip aliases to pipes, boolean control structures and other command lists
|
# skip aliases to pipes, boolean control structures and other command lists
|
||||||
chars=$'|&;()<>\n'
|
chars=$'|&;()<>\n'
|
||||||
if [[ "${alias_defn}" =~ [$chars] ]]; then
|
if [[ "${alias_defn}" =~ [$chars] ]]
|
||||||
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# avoid expanding wildcards
|
# avoid expanding wildcards
|
||||||
read -ra alias_arg_words <<< "$alias_args"
|
read -ra alias_arg_words <<< "$alias_args"
|
||||||
|
|
||||||
# skip alias if there is no completion function triggered by the aliased command
|
# skip alias if there is no completion function triggered by the aliased command
|
||||||
if ! _bash-it-array-contains-element "$alias_cmd" "${completions[@]}"; then
|
if ! _bash-it-array-contains-element "$alias_cmd" "${completions[@]}"
|
||||||
if [[ -n "$completion_loader" ]]; then
|
then
|
||||||
|
if [[ -n "$completion_loader" ]]
|
||||||
|
then
|
||||||
# force loading of completions for the aliased command
|
# force loading of completions for the aliased command
|
||||||
"${completion_loader:?}" "${alias_cmd}"
|
"${completion_loader:?}" "${alias_cmd}"
|
||||||
# 124 means completion loader was successful
|
# 124 means completion loader was successful
|
||||||
|
|
@ -72,11 +82,13 @@ function _bash-it-component-completion-callback-on-init-aliases() {
|
||||||
new_completion="$(complete -p "$alias_cmd" 2> /dev/null)"
|
new_completion="$(complete -p "$alias_cmd" 2> /dev/null)"
|
||||||
|
|
||||||
# create a wrapper inserting the alias arguments if any
|
# create a wrapper inserting the alias arguments if any
|
||||||
if [[ -n $alias_args ]]; then
|
if [[ -n $alias_args ]]
|
||||||
|
then
|
||||||
compl_func="${new_completion/#* -F /}"
|
compl_func="${new_completion/#* -F /}"
|
||||||
compl_func="${compl_func%% *}"
|
compl_func="${compl_func%% *}"
|
||||||
# avoid recursive call loops by ignoring our own functions
|
# avoid recursive call loops by ignoring our own functions
|
||||||
if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]]; then
|
if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]]
|
||||||
|
then
|
||||||
compl_wrapper="_${namespace}::${alias_name}"
|
compl_wrapper="_${namespace}::${alias_name}"
|
||||||
echo "function $compl_wrapper {
|
echo "function $compl_wrapper {
|
||||||
local compl_word=\${2?}
|
local compl_word=\${2?}
|
||||||
|
|
@ -84,7 +96,8 @@ function _bash-it-component-completion-callback-on-init-aliases() {
|
||||||
# check if prec_word is the alias itself. if so, replace it
|
# check if prec_word is the alias itself. if so, replace it
|
||||||
# with the last word in the unaliased form, i.e.,
|
# with the last word in the unaliased form, i.e.,
|
||||||
# alias_cmd + ' ' + alias_args.
|
# alias_cmd + ' ' + alias_args.
|
||||||
if [[ \$COMP_LINE == \"\$prec_word \$compl_word\" ]]; then
|
if [[ \$COMP_LINE == \"\$prec_word \$compl_word\" ]]
|
||||||
|
then
|
||||||
prec_word='$alias_cmd $alias_args'
|
prec_word='$alias_cmd $alias_args'
|
||||||
prec_word=\${prec_word#* }
|
prec_word=\${prec_word#* }
|
||||||
fi
|
fi
|
||||||
|
|
@ -100,7 +113,8 @@ function _bash-it-component-completion-callback-on-init-aliases() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# replace completion trigger by alias
|
# replace completion trigger by alias
|
||||||
if [[ -n $new_completion ]]; then
|
if [[ -n $new_completion ]]
|
||||||
|
then
|
||||||
new_completion="${new_completion% *} $alias_name"
|
new_completion="${new_completion% *} $alias_name"
|
||||||
echo "$new_completion" >> "$tmp_file"
|
echo "$new_completion" >> "$tmp_file"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
if _command_exists awless; then
|
if _command_exists awless
|
||||||
|
then
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source <(awless completion bash)
|
source <(awless completion bash)
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
if _command_exists aws_completer; then
|
if _command_exists aws_completer
|
||||||
|
then
|
||||||
complete -C "$(command -v aws_completer)" aws
|
complete -C "$(command -v aws_completer)" aws
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,24 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
function _compreply_candidates() {
|
function _compreply_candidates()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
|
|
||||||
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]}" -- "${cur}")
|
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]}" -- "${cur}")
|
||||||
}
|
}
|
||||||
|
|
||||||
function _bash-it() {
|
function _bash-it()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
local cur prev verb file_type candidates suffix
|
local cur prev verb file_type candidates suffix
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
|
@ -20,7 +32,8 @@ function _bash-it() {
|
||||||
_compreply_candidates
|
_compreply_candidates
|
||||||
;;
|
;;
|
||||||
help)
|
help)
|
||||||
if [[ "${prev}" == "aliases" ]]; then
|
if [[ "${prev}" == "aliases" ]]
|
||||||
|
then
|
||||||
candidates=('all' "$(_bash-it-component-list "${file_type}")")
|
candidates=('all' "$(_bash-it-component-list "${file_type}")")
|
||||||
_compreply_candidates
|
_compreply_candidates
|
||||||
else
|
else
|
||||||
|
|
@ -31,7 +44,8 @@ function _bash-it() {
|
||||||
profile)
|
profile)
|
||||||
case "${file_type}" in
|
case "${file_type}" in
|
||||||
load | rm)
|
load | rm)
|
||||||
if [[ "${file_type}" == "$prev" ]]; then
|
if [[ "${file_type}" == "$prev" ]]
|
||||||
|
then
|
||||||
candidates=("${BASH_IT}/profiles"/*.bash_it)
|
candidates=("${BASH_IT}/profiles"/*.bash_it)
|
||||||
candidates=("${candidates[@]##*/}")
|
candidates=("${candidates[@]##*/}")
|
||||||
candidates=("${candidates[@]%%.bash_it}")
|
candidates=("${candidates[@]%%.bash_it}")
|
||||||
|
|
@ -51,7 +65,8 @@ function _bash-it() {
|
||||||
_compreply_candidates
|
_compreply_candidates
|
||||||
;;
|
;;
|
||||||
update)
|
update)
|
||||||
if [[ "${cur}" == -* ]]; then
|
if [[ "${cur}" == -* ]]
|
||||||
|
then
|
||||||
candidates=('-s' '--silent')
|
candidates=('-s' '--silent')
|
||||||
else
|
else
|
||||||
candidates=('stable' 'dev')
|
candidates=('stable' 'dev')
|
||||||
|
|
@ -64,7 +79,8 @@ function _bash-it() {
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
enable | disable)
|
enable | disable)
|
||||||
if [[ "${verb}" == "enable" ]]; then
|
if [[ "${verb}" == "enable" ]]
|
||||||
|
then
|
||||||
suffix="disabled"
|
suffix="disabled"
|
||||||
else
|
else
|
||||||
suffix="enabled"
|
suffix="enabled"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ about-completion "brew completion"
|
||||||
# Load late to make sure `system` completion loads first
|
# Load late to make sure `system` completion loads first
|
||||||
# BASH_IT_LOAD_PRIORITY: 375
|
# BASH_IT_LOAD_PRIORITY: 375
|
||||||
|
|
||||||
if [[ "$OSTYPE" != 'darwin'* ]]; then
|
if [[ "$OSTYPE" != 'darwin'* ]];
|
||||||
|
then
|
||||||
_log_warning "unsupported operating system - only 'Darwin' is supported"
|
_log_warning "unsupported operating system - only 'Darwin' is supported"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -13,15 +14,18 @@ fi
|
||||||
# Make sure brew is installed
|
# Make sure brew is installed
|
||||||
_bash_it_homebrew_check || return 0
|
_bash_it_homebrew_check || return 0
|
||||||
|
|
||||||
if [[ -r "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew" ]]; then
|
if [[ -r "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew" ]]
|
||||||
|
then
|
||||||
# shellcheck disable=1090,1091
|
# shellcheck disable=1090,1091
|
||||||
source "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew"
|
source "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew"
|
||||||
|
|
||||||
elif [[ -r "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh" ]]; then
|
elif [[ -r "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh" ]]
|
||||||
|
then
|
||||||
# shellcheck disable=1090,1091
|
# shellcheck disable=1090,1091
|
||||||
source "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh"
|
source "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh"
|
||||||
|
|
||||||
elif [[ -f "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew" ]]; then
|
elif [[ -f "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew" ]]
|
||||||
|
then
|
||||||
# For the git-clone based installation, see here for more info:
|
# For the git-clone based installation, see here for more info:
|
||||||
# https://github.com/Bash-it/bash-it/issues/1458
|
# https://github.com/Bash-it/bash-it/issues/1458
|
||||||
# https://docs.brew.sh/Shell-Completion
|
# https://docs.brew.sh/Shell-Completion
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
# To use, source this file on bash:
|
# To use, source this file on bash:
|
||||||
# . completion-bundle
|
# . completion-bundle
|
||||||
|
|
||||||
__bundle() {
|
function __bundle() {
|
||||||
local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "$1")
|
local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "${1}")
|
||||||
local cur prev
|
local cur prev
|
||||||
_get_comp_words_by_ref -n : cur prev
|
_get_comp_words_by_ref -n : cur prev
|
||||||
local bundle_command
|
local bundle_command
|
||||||
|
|
@ -37,7 +37,8 @@ __bundle() {
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
|
|
||||||
local options
|
local options
|
||||||
if [[ $cur = -* && $bundle_command != exec ]]; then
|
if [[ $cur = -* && $bundle_command != exec ]]
|
||||||
|
then
|
||||||
options="-V --help --no-color --no-no-color --verbose --no-verbose"
|
options="-V --help --no-color --no-no-color --verbose --no-verbose"
|
||||||
case $bundle_command in
|
case $bundle_command in
|
||||||
"")
|
"")
|
||||||
|
|
@ -140,10 +141,12 @@ __bundle() {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
exec)
|
exec)
|
||||||
if [[ $COMP_CWORD -eq $bundle_command_index ]]; then
|
if [[ $COMP_CWORD -eq $bundle_command_index ]]
|
||||||
|
then
|
||||||
# Figure out Bundler's binaries dir
|
# Figure out Bundler's binaries dir
|
||||||
local bundler_bin=$(__bundle_exec_ruby 'puts Bundler.bundle_path + "bin"')
|
local bundler_bin=$(__bundle_exec_ruby 'puts Bundler.bundle_path + "bin"')
|
||||||
if [[ -d $bundler_bin ]]; then
|
if [[ -d $bundler_bin ]]
|
||||||
|
then
|
||||||
local binaries=("$bundler_bin"/*)
|
local binaries=("$bundler_bin"/*)
|
||||||
# If there are binaries, strip directory name and use them
|
# If there are binaries, strip directory name and use them
|
||||||
[[ -f "$binaries" ]] && options="${binaries[@]##*/}"
|
[[ -f "$binaries" ]] && options="${binaries[@]##*/}"
|
||||||
|
|
@ -190,7 +193,7 @@ __bundle() {
|
||||||
COMPREPLY=($(compgen -W "${options[*]}" -- "$cur"))
|
COMPREPLY=($(compgen -W "${options[*]}" -- "$cur"))
|
||||||
}
|
}
|
||||||
|
|
||||||
__bundle_get_command() {
|
function __bundle_get_command() {
|
||||||
local i
|
local i
|
||||||
for ((i=1; i < $COMP_CWORD; ++i)); do
|
for ((i=1; i < $COMP_CWORD; ++i)); do
|
||||||
local arg=${COMP_WORDS[$i]}
|
local arg=${COMP_WORDS[$i]}
|
||||||
|
|
@ -216,13 +219,14 @@ __bundle_get_command() {
|
||||||
#
|
#
|
||||||
# Multiple groups can be entered, separated either by spaces or by colons.
|
# Multiple groups can be entered, separated either by spaces or by colons.
|
||||||
# Input is read from $cur, and the result is directly written to $COMPREPLY.
|
# Input is read from $cur, and the result is directly written to $COMPREPLY.
|
||||||
__bundle_complete_groups() {
|
function __bundle_complete_groups() {
|
||||||
# Group being currently written
|
# Group being currently written
|
||||||
local cur_group=${cur##*[ :]}
|
local cur_group=${cur##*[ :]}
|
||||||
# All groups written before
|
# All groups written before
|
||||||
local prefix=${cur%"$cur_group"}
|
local prefix=${cur%"$cur_group"}
|
||||||
local groups=$(__bundle_exec_ruby 'puts Bundler.definition.dependencies.map(&:groups).reduce(:|).map(&:to_s)')
|
local groups=$(__bundle_exec_ruby 'puts Bundler.definition.dependencies.map(&:groups).reduce(:|).map(&:to_s)')
|
||||||
if [[ ! $groups ]]; then
|
if [[ ! $groups ]]
|
||||||
|
then
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -241,7 +245,7 @@ __bundle_complete_groups() {
|
||||||
#
|
#
|
||||||
# Runs a Ruby script with Bundler loaded.
|
# Runs a Ruby script with Bundler loaded.
|
||||||
# Results may be cached.
|
# Results may be cached.
|
||||||
__bundle_exec_ruby() {
|
function __bundle_exec_ruby() {
|
||||||
local bundle_bin=(${bundle_bin[@]:-bundle})
|
local bundle_bin=(${bundle_bin[@]:-bundle})
|
||||||
# Lockfile is inferred here, and might not be correct (for example, when
|
# Lockfile is inferred here, and might not be correct (for example, when
|
||||||
# running on a subdirectory). However, a wrong file path won't be a
|
# running on a subdirectory). However, a wrong file path won't be a
|
||||||
|
|
@ -256,11 +260,13 @@ __bundle_exec_ruby() {
|
||||||
local cache_id_line="${bundle_bin[*]} @ $lockfile: ${*//$'\n'/ }"
|
local cache_id_line="${bundle_bin[*]} @ $lockfile: ${*//$'\n'/ }"
|
||||||
|
|
||||||
if [[ (! -f $lockfile || $cachefile -nt $lockfile) &&
|
if [[ (! -f $lockfile || $cachefile -nt $lockfile) &&
|
||||||
$(head -n 1 -- "$cachefile" 2>/dev/null) = "$cache_id_line" ]]; then
|
$(head -n 1 -- "$cachefile" 2>/dev/null) = "$cache_id_line" ]]
|
||||||
|
then
|
||||||
tail -n +2 -- "$cachefile"
|
tail -n +2 -- "$cachefile"
|
||||||
else
|
else
|
||||||
local output=$("${bundle_bin[@]}" exec ruby -e "$@" 2>/dev/null)
|
local output=$("${bundle_bin[@]}" exec ruby -e "$@" 2>/dev/null)
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]
|
||||||
|
then
|
||||||
(mkdir -p -- "$cachedir" &&
|
(mkdir -p -- "$cachedir" &&
|
||||||
echo "$cache_id_line"$'\n'"$output" >$cachefile) 2>/dev/null
|
echo "$cache_id_line"$'\n'"$output" >$cachefile) 2>/dev/null
|
||||||
echo "$output"
|
echo "$output"
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,15 @@
|
||||||
|
|
||||||
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
|
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
|
||||||
|
|
||||||
_capcomplete() {
|
function _capcomplete() {
|
||||||
if [ -f Capfile ]; then
|
if [ -f Capfile ]
|
||||||
|
then
|
||||||
recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1`
|
recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1`
|
||||||
if [[ $recent != '.cap_tasks~' ]]; then
|
if [[ $recent != '.cap_tasks~' ]]
|
||||||
|
then
|
||||||
cap --version | grep 'Capistrano v2.' > /dev/null
|
cap --version | grep 'Capistrano v2.' > /dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
# Capistrano 2.x
|
# Capistrano 2.x
|
||||||
cap --tool --verbose --tasks | cut -d " " -f 2 > .cap_tasks~
|
cap --tool --verbose --tasks | cut -d " " -f 2 > .cap_tasks~
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# cargo (Rust package manager) completion
|
# cargo (Rust package manager) completion
|
||||||
|
|
||||||
if _binary_exists rustup && _binary_exists cargo; then
|
if _binary_exists rustup && _binary_exists cargo
|
||||||
|
then
|
||||||
eval "$(rustup completions bash cargo)"
|
eval "$(rustup completions bash cargo)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,29 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "composer completion"
|
about-completion "composer completion"
|
||||||
|
|
||||||
function __composer_completion() {
|
function __composer_completion()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
local cur coms opts com words
|
local cur coms opts com words
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
_get_comp_words_by_ref -n : cur words
|
_get_comp_words_by_ref -n : cur words
|
||||||
|
|
||||||
# lookup for command
|
# lookup for command
|
||||||
for word in "${words[@]:1}"; do
|
for word in "${words[@]:1}"; do
|
||||||
if [[ "${word}" != -* ]]; then
|
if [[ "${word}" != -* ]]
|
||||||
|
then
|
||||||
com="${word}"
|
com="${word}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# completing for an option
|
# completing for an option
|
||||||
if [[ ${cur} == --* ]]; then
|
if [[ ${cur} == --* ]]
|
||||||
|
then
|
||||||
opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir"
|
opts="--help --quiet --verbose --version --ansi --no-ansi --no-interaction --profile --no-plugins --working-dir"
|
||||||
|
|
||||||
case "${com}" in
|
case "${com}" in
|
||||||
|
|
@ -115,7 +123,8 @@ function __composer_completion() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# completing for a command
|
# completing for a command
|
||||||
if [[ "${cur}" == "${com}" ]]; then
|
if [[ "${cur}" == "${com}" ]]
|
||||||
|
then
|
||||||
coms="about archive browse clear-cache config create-project depends diagnose dump-autoload exec global help init install licenses list outdated prohibits remove require run-script search self-update show status suggests update validate"
|
coms="about archive browse clear-cache config create-project depends diagnose dump-autoload exec global help init install licenses list outdated prohibits remove require run-script search self-update show status suggests update validate"
|
||||||
|
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "conda completion"
|
about-completion "conda completion"
|
||||||
|
|
||||||
if _command_exists conda; then
|
if _command_exists conda
|
||||||
if _command_exists register-python-argcomplete; then
|
then
|
||||||
|
if _command_exists register-python-argcomplete
|
||||||
|
then
|
||||||
eval "$(register-python-argcomplete conda)"
|
eval "$(register-python-argcomplete conda)"
|
||||||
else
|
else
|
||||||
_log_warning "Argcomplete not found. Please run 'conda install argcomplete'"
|
_log_warning "Argcomplete not found. Please run 'conda install argcomplete'"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "Hashicorp consul completion"
|
about-completion "Hashicorp consul completion"
|
||||||
|
|
||||||
if _command_exists consul; then
|
if _command_exists consul
|
||||||
|
then
|
||||||
complete -C "$(command -v consul)" consul
|
complete -C "$(command -v consul)" consul
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
__dart_completion() {
|
function __dart_completion() {
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
local prev=$(_get_pword)
|
local prev=$(_get_pword)
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
if test -s "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash"; then
|
if test -s "${BASH_IT?}/vendor/github.com/gaelicWizard/bash-progcomp/defaults.completion.bash"
|
||||||
|
then
|
||||||
source "$_"
|
source "$_"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Bash completion support for the 'dirs' plugin (commands G, R).
|
# Bash completion support for the 'dirs' plugin (commands G, R).
|
||||||
|
|
||||||
_dirs-complete() {
|
function _dirs-complete() {
|
||||||
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
|
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
|
||||||
# parse all defined shortcuts from ~/.dirs
|
# parse all defined shortcuts from ~/.dirs
|
||||||
if [ -r "$HOME/.dirs" ]; then
|
if [ -r "$HOME/.dirs" ]
|
||||||
|
then
|
||||||
COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- ${CURRENT_PROMPT}) )
|
COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- ${CURRENT_PROMPT}) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@
|
||||||
__docker_compose_previous_extglob_setting=$(shopt -p extglob)
|
__docker_compose_previous_extglob_setting=$(shopt -p extglob)
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
__docker_compose_q() {
|
function __docker_compose_q() {
|
||||||
docker-compose 2>/dev/null "${top_level_options[@]}" "$@"
|
docker-compose 2>/dev/null "${top_level_options[@]}" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Transforms a multiline list of strings into a single line string
|
# Transforms a multiline list of strings into a single line string
|
||||||
# with the words separated by "|".
|
# with the words separated by "|".
|
||||||
__docker_compose_to_alternatives() {
|
function __docker_compose_to_alternatives() {
|
||||||
local parts=( $1 )
|
local parts=( $1 )
|
||||||
local IFS='|'
|
local IFS='|'
|
||||||
echo "${parts[*]}"
|
echo "${parts[*]}"
|
||||||
|
|
@ -48,17 +48,18 @@ __docker_compose_to_alternatives() {
|
||||||
|
|
||||||
# Transforms a multiline list of options into an extglob pattern
|
# Transforms a multiline list of options into an extglob pattern
|
||||||
# suitable for use in case statements.
|
# suitable for use in case statements.
|
||||||
__docker_compose_to_extglob() {
|
function __docker_compose_to_extglob() {
|
||||||
local extglob=$( __docker_compose_to_alternatives "$1" )
|
local extglob=$( __docker_compose_to_alternatives "${1}" )
|
||||||
echo "@($extglob)"
|
echo "@($extglob)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determines whether the option passed as the first argument exist on
|
# Determines whether the option passed as the first argument exist on
|
||||||
# the commandline. The option may be a pattern, e.g. `--force|-f`.
|
# the commandline. The option may be a pattern, e.g. `--force|-f`.
|
||||||
__docker_compose_has_option() {
|
function __docker_compose_has_option() {
|
||||||
local pattern="$1"
|
local pattern="${1}"
|
||||||
for (( i=2; i < $cword; ++i)); do
|
for (( i=2; i < $cword; ++i)); do
|
||||||
if [[ ${words[$i]} =~ ^($pattern)$ ]] ; then
|
if [[ ${words[$i]} =~ ^($pattern)$ ]]
|
||||||
|
then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -68,17 +69,20 @@ __docker_compose_has_option() {
|
||||||
# Returns `key` if we are currently completing the value of a map option (`key=value`)
|
# Returns `key` if we are currently completing the value of a map option (`key=value`)
|
||||||
# which matches the extglob passed in as an argument.
|
# which matches the extglob passed in as an argument.
|
||||||
# This function is needed for key-specific completions.
|
# This function is needed for key-specific completions.
|
||||||
__docker_compose_map_key_of_current_option() {
|
function __docker_compose_map_key_of_current_option() {
|
||||||
local glob="$1"
|
local glob="${1}"
|
||||||
|
|
||||||
local key glob_pos
|
local key glob_pos
|
||||||
if [ "$cur" = "=" ] ; then # key= case
|
if [ "$cur" = "=" ]
|
||||||
|
then # key= case
|
||||||
key="$prev"
|
key="$prev"
|
||||||
glob_pos=$((cword - 2))
|
glob_pos=$((cword - 2))
|
||||||
elif [[ $cur == *=* ]] ; then # key=value case (OSX)
|
elif [[ $cur == *=* ]]
|
||||||
|
then # key=value case (OSX)
|
||||||
key=${cur%=*}
|
key=${cur%=*}
|
||||||
glob_pos=$((cword - 1))
|
glob_pos=$((cword - 1))
|
||||||
elif [ "$prev" = "=" ] ; then
|
elif [ "$prev" = "=" ]
|
||||||
|
then
|
||||||
key=${words[$cword - 2]} # key=value case
|
key=${words[$cword - 2]} # key=value case
|
||||||
glob_pos=$((cword - 3))
|
glob_pos=$((cword - 3))
|
||||||
else
|
else
|
||||||
|
|
@ -91,7 +95,7 @@ __docker_compose_map_key_of_current_option() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# suppress trailing whitespace
|
# suppress trailing whitespace
|
||||||
__docker_compose_nospace() {
|
function __docker_compose_nospace() {
|
||||||
# compopt is not available in ancient bash versions
|
# compopt is not available in ancient bash versions
|
||||||
type compopt &>/dev/null && compopt -o nospace
|
type compopt &>/dev/null && compopt -o nospace
|
||||||
}
|
}
|
||||||
|
|
@ -100,25 +104,25 @@ __docker_compose_nospace() {
|
||||||
# Outputs a list of all defined services, regardless of their running state.
|
# Outputs a list of all defined services, regardless of their running state.
|
||||||
# Arguments for `docker-compose ps` may be passed in order to filter the service list,
|
# Arguments for `docker-compose ps` may be passed in order to filter the service list,
|
||||||
# e.g. `status=running`.
|
# e.g. `status=running`.
|
||||||
__docker_compose_services() {
|
function __docker_compose_services() {
|
||||||
__docker_compose_q ps --services "$@"
|
__docker_compose_q ps --services "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Applies completion of services based on the current value of `$cur`.
|
# Applies completion of services based on the current value of `$cur`.
|
||||||
# Arguments for `docker-compose ps` may be passed in order to filter the service list,
|
# Arguments for `docker-compose ps` may be passed in order to filter the service list,
|
||||||
# see `__docker_compose_services`.
|
# see `__docker_compose_services`.
|
||||||
__docker_compose_complete_services() {
|
function __docker_compose_complete_services() {
|
||||||
COMPREPLY=( $(compgen -W "$(__docker_compose_services "$@")" -- "$cur") )
|
COMPREPLY=( $(compgen -W "$(__docker_compose_services "$@")" -- "$cur") )
|
||||||
}
|
}
|
||||||
|
|
||||||
# The services for which at least one running container exists
|
# The services for which at least one running container exists
|
||||||
__docker_compose_complete_running_services() {
|
function __docker_compose_complete_running_services() {
|
||||||
local names=$(__docker_compose_services --filter status=running)
|
local names=$(__docker_compose_services --filter status=running)
|
||||||
COMPREPLY=( $(compgen -W "$names" -- "$cur") )
|
COMPREPLY=( $(compgen -W "$names" -- "$cur") )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_build() {
|
function _docker_compose_build() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--build-arg)
|
--build-arg)
|
||||||
COMPREPLY=( $( compgen -e -- "$cur" ) )
|
COMPREPLY=( $( compgen -e -- "$cur" ) )
|
||||||
|
|
@ -141,7 +145,7 @@ _docker_compose_build() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_bundle() {
|
function _docker_compose_bundle() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--output|-o)
|
--output|-o)
|
||||||
_filedir
|
_filedir
|
||||||
|
|
@ -153,10 +157,11 @@ _docker_compose_bundle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_config() {
|
function _docker_compose_config() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--hash)
|
--hash)
|
||||||
if [[ $cur == \\* ]] ; then
|
if [[ $cur == \\* ]]
|
||||||
|
then
|
||||||
COMPREPLY=( '\*' )
|
COMPREPLY=( '\*' )
|
||||||
else
|
else
|
||||||
COMPREPLY=( $(compgen -W "$(__docker_compose_services) \\\* " -- "$cur") )
|
COMPREPLY=( $(compgen -W "$(__docker_compose_services) \\\* " -- "$cur") )
|
||||||
|
|
@ -169,7 +174,7 @@ _docker_compose_config() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_create() {
|
function _docker_compose_create() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--build --force-recreate --help --no-build --no-recreate" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--build --force-recreate --help --no-build --no-recreate" -- "$cur" ) )
|
||||||
|
|
@ -181,7 +186,7 @@ _docker_compose_create() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_docker_compose() {
|
function _docker_compose_docker_compose() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--tlscacert|--tlscert|--tlskey)
|
--tlscacert|--tlscert|--tlskey)
|
||||||
_filedir
|
_filedir
|
||||||
|
|
@ -215,7 +220,7 @@ _docker_compose_docker_compose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_down() {
|
function _docker_compose_down() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--rmi)
|
--rmi)
|
||||||
COMPREPLY=( $( compgen -W "all local" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "all local" -- "$cur" ) )
|
||||||
|
|
@ -234,7 +239,7 @@ _docker_compose_down() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_events() {
|
function _docker_compose_events() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--json)
|
--json)
|
||||||
return
|
return
|
||||||
|
|
@ -252,7 +257,7 @@ _docker_compose_events() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_exec() {
|
function _docker_compose_exec() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--index|--user|-u|--workdir|-w)
|
--index|--user|-u|--workdir|-w)
|
||||||
return
|
return
|
||||||
|
|
@ -270,11 +275,11 @@ _docker_compose_exec() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_help() {
|
function _docker_compose_help() {
|
||||||
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
_docker_compose_images() {
|
function _docker_compose_images() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--help --quiet -q" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--help --quiet -q" -- "$cur" ) )
|
||||||
|
|
@ -285,7 +290,7 @@ _docker_compose_images() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
_docker_compose_kill() {
|
function _docker_compose_kill() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
-s)
|
-s)
|
||||||
COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) )
|
COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) )
|
||||||
|
|
@ -304,7 +309,7 @@ _docker_compose_kill() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_logs() {
|
function _docker_compose_logs() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--tail)
|
--tail)
|
||||||
return
|
return
|
||||||
|
|
@ -322,7 +327,7 @@ _docker_compose_logs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_pause() {
|
function _docker_compose_pause() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
||||||
|
|
@ -334,7 +339,7 @@ _docker_compose_pause() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_port() {
|
function _docker_compose_port() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--protocol)
|
--protocol)
|
||||||
COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) )
|
||||||
|
|
@ -356,7 +361,7 @@ _docker_compose_port() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_ps() {
|
function _docker_compose_ps() {
|
||||||
local key=$(__docker_compose_map_key_of_current_option '--filter')
|
local key=$(__docker_compose_map_key_of_current_option '--filter')
|
||||||
case "$key" in
|
case "$key" in
|
||||||
source)
|
source)
|
||||||
|
|
@ -388,7 +393,7 @@ _docker_compose_ps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_pull() {
|
function _docker_compose_pull() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--help --ignore-pull-failures --include-deps --no-parallel --quiet -q" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--help --ignore-pull-failures --include-deps --no-parallel --quiet -q" -- "$cur" ) )
|
||||||
|
|
@ -400,7 +405,7 @@ _docker_compose_pull() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_push() {
|
function _docker_compose_push() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--help --ignore-push-failures" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--help --ignore-push-failures" -- "$cur" ) )
|
||||||
|
|
@ -412,7 +417,7 @@ _docker_compose_push() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_restart() {
|
function _docker_compose_restart() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--timeout|-t)
|
--timeout|-t)
|
||||||
return
|
return
|
||||||
|
|
@ -430,13 +435,14 @@ _docker_compose_restart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_rm() {
|
function _docker_compose_rm() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--force -f --help --stop -s -v" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--force -f --help --stop -s -v" -- "$cur" ) )
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if __docker_compose_has_option "--stop|-s" ; then
|
if __docker_compose_has_option "--stop|-s"
|
||||||
|
then
|
||||||
__docker_compose_complete_services
|
__docker_compose_complete_services
|
||||||
else
|
else
|
||||||
__docker_compose_complete_services --filter status=stopped
|
__docker_compose_complete_services --filter status=stopped
|
||||||
|
|
@ -446,7 +452,7 @@ _docker_compose_rm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_run() {
|
function _docker_compose_run() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
-e)
|
-e)
|
||||||
COMPREPLY=( $( compgen -e -- "$cur" ) )
|
COMPREPLY=( $( compgen -e -- "$cur" ) )
|
||||||
|
|
@ -469,7 +475,7 @@ _docker_compose_run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_scale() {
|
function _docker_compose_scale() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
=)
|
=)
|
||||||
COMPREPLY=("$cur")
|
COMPREPLY=("$cur")
|
||||||
|
|
@ -492,7 +498,7 @@ _docker_compose_scale() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_start() {
|
function _docker_compose_start() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
||||||
|
|
@ -504,7 +510,7 @@ _docker_compose_start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_stop() {
|
function _docker_compose_stop() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--timeout|-t)
|
--timeout|-t)
|
||||||
return
|
return
|
||||||
|
|
@ -522,7 +528,7 @@ _docker_compose_stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_top() {
|
function _docker_compose_top() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
||||||
|
|
@ -534,7 +540,7 @@ _docker_compose_top() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_unpause() {
|
function _docker_compose_unpause() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
|
||||||
|
|
@ -546,7 +552,7 @@ _docker_compose_unpause() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_up() {
|
function _docker_compose_up() {
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
=)
|
=)
|
||||||
COMPREPLY=("$cur")
|
COMPREPLY=("$cur")
|
||||||
|
|
@ -577,7 +583,7 @@ _docker_compose_up() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose_version() {
|
function _docker_compose_version() {
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W "--short" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "--short" -- "$cur" ) )
|
||||||
|
|
@ -586,7 +592,7 @@ _docker_compose_version() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_docker_compose() {
|
function _docker_compose() {
|
||||||
local previous_extglob_setting=$(shopt -p extglob)
|
local previous_extglob_setting=$(shopt -p extglob)
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ _docker_bash_completion_paths=(
|
||||||
)
|
)
|
||||||
|
|
||||||
for fn in "${_docker_bash_completion_paths[@]}"; do
|
for fn in "${_docker_bash_completion_paths[@]}"; do
|
||||||
if [ -r "$fn" ]; then
|
if [ -r "$fn" ]
|
||||||
|
then
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "$fn"
|
source "$fn"
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,13 @@
|
||||||
about-completion "bash parameter completion for the dotnet CLI"
|
about-completion "bash parameter completion for the dotnet CLI"
|
||||||
# see https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#bash
|
# see https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#bash
|
||||||
|
|
||||||
function _dotnet_bash_complete() {
|
function _dotnet_bash_complete()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}" IFS=$'\n'
|
local cur="${COMP_WORDS[COMP_CWORD]}" IFS=$'\n'
|
||||||
local candidates
|
local candidates
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,13 @@ esac
|
||||||
#
|
#
|
||||||
# Get time of last fab cache file modification as seconds since Epoch
|
# Get time of last fab cache file modification as seconds since Epoch
|
||||||
#
|
#
|
||||||
function __fab_chache_mtime() {
|
function __fab_chache_mtime()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
${__FAB_COMPLETION_MTIME_COMMAND} \
|
${__FAB_COMPLETION_MTIME_COMMAND} \
|
||||||
$FAB_COMPLETION_CACHED_TASKS_FILENAME | xargs -n 1 expr
|
$FAB_COMPLETION_CACHED_TASKS_FILENAME | xargs -n 1 expr
|
||||||
}
|
}
|
||||||
|
|
@ -63,9 +69,16 @@ function __fab_chache_mtime() {
|
||||||
#
|
#
|
||||||
# Get time of last fabfile file/module modification as seconds since Epoch
|
# Get time of last fabfile file/module modification as seconds since Epoch
|
||||||
#
|
#
|
||||||
function __fab_fabfile_mtime() {
|
function __fab_fabfile_mtime()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
local f="fabfile"
|
local f="fabfile"
|
||||||
if [[ -e "$f.py" ]]; then
|
if [[ -e "$f.py" ]]
|
||||||
|
then
|
||||||
${__FAB_COMPLETION_MTIME_COMMAND} "$f.py" | xargs -n 1 expr
|
${__FAB_COMPLETION_MTIME_COMMAND} "$f.py" | xargs -n 1 expr
|
||||||
else
|
else
|
||||||
# Suppose that it's a fabfile dir
|
# Suppose that it's a fabfile dir
|
||||||
|
|
@ -78,7 +91,13 @@ function __fab_fabfile_mtime() {
|
||||||
#
|
#
|
||||||
# Completion for "fab" command
|
# Completion for "fab" command
|
||||||
#
|
#
|
||||||
function __fab_completion() {
|
function __fab_completion()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
# Return if "fab" command doesn't exists
|
# Return if "fab" command doesn't exists
|
||||||
[[ -e `which fab 2> /dev/null` ]] || return 0
|
[[ -e `which fab 2> /dev/null` ]] || return 0
|
||||||
|
|
||||||
|
|
@ -89,7 +108,8 @@ function __fab_completion() {
|
||||||
# Generate possible matches and store them in variable "opts"
|
# Generate possible matches and store them in variable "opts"
|
||||||
case "${cur}" in
|
case "${cur}" in
|
||||||
-*)
|
-*)
|
||||||
if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]; then
|
if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]
|
||||||
|
then
|
||||||
export __FAB_COMPLETION_LONG_OPT=$(
|
export __FAB_COMPLETION_LONG_OPT=$(
|
||||||
fab --help | grep -E -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
|
fab --help | grep -E -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
|
||||||
fi
|
fi
|
||||||
|
|
@ -99,7 +119,8 @@ function __fab_completion() {
|
||||||
# Completion for short options is not nessary.
|
# Completion for short options is not nessary.
|
||||||
# It's left here just for history.
|
# It's left here just for history.
|
||||||
# -*)
|
# -*)
|
||||||
# if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]; then
|
# if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]
|
||||||
|
then
|
||||||
# export __FAB_COMPLETION_SHORT_OPT=$(
|
# export __FAB_COMPLETION_SHORT_OPT=$(
|
||||||
# fab --help | grep -E -o "^ +\-[A-Za-z_\]" | sort -u)
|
# fab --help | grep -E -o "^ +\-[A-Za-z_\]" | sort -u)
|
||||||
# fi
|
# fi
|
||||||
|
|
@ -109,12 +130,15 @@ function __fab_completion() {
|
||||||
*)
|
*)
|
||||||
# If "fabfile.py" or "fabfile" dir with "__init__.py" file exists
|
# If "fabfile.py" or "fabfile" dir with "__init__.py" file exists
|
||||||
local f="fabfile"
|
local f="fabfile"
|
||||||
if [[ -e "$f.py" || (-d "$f" && -e "$f/__init__.py") ]]; then
|
if [[ -e "$f.py" || (-d "$f" && -e "$f/__init__.py") ]]
|
||||||
|
then
|
||||||
# Build a list of the available tasks
|
# Build a list of the available tasks
|
||||||
if $FAB_COMPLETION_CACHE_TASKS; then
|
if $FAB_COMPLETION_CACHE_TASKS
|
||||||
|
then
|
||||||
# If use cache
|
# If use cache
|
||||||
if [[ ! -s ${FAB_COMPLETION_CACHED_TASKS_FILENAME} ||
|
if [[ ! -s ${FAB_COMPLETION_CACHED_TASKS_FILENAME} ||
|
||||||
$(__fab_fabfile_mtime) -gt $(__fab_chache_mtime) ]]; then
|
$(__fab_fabfile_mtime) -gt $(__fab_chache_mtime) ]]
|
||||||
|
then
|
||||||
fab --shortlist > ${FAB_COMPLETION_CACHED_TASKS_FILENAME} \
|
fab --shortlist > ${FAB_COMPLETION_CACHED_TASKS_FILENAME} \
|
||||||
2> /dev/null
|
2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
if _command_exists flutter; then
|
if _command_exists flutter
|
||||||
|
then
|
||||||
eval "$(flutter bash-completion)"
|
eval "$(flutter bash-completion)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "Google Cloud SDK completion"
|
about-completion "Google Cloud SDK completion"
|
||||||
|
|
||||||
if _command_exists gcloud; then
|
if _command_exists gcloud
|
||||||
|
then
|
||||||
# get install path
|
# get install path
|
||||||
GOOGLE_SDK_ROOT=${GOOGLE_SDK_ROOT:-$(gcloud info --format="value(installation.sdk_root)")}
|
GOOGLE_SDK_ROOT=${GOOGLE_SDK_ROOT:-$(gcloud info --format="value(installation.sdk_root)")}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ __gem_completion() {
|
||||||
case $prev in
|
case $prev in
|
||||||
install)
|
install)
|
||||||
# list the remote gems and add to completion
|
# list the remote gems and add to completion
|
||||||
if [ -z "$REMOTE_GEMS" ]; then
|
if [ -z "$REMOTE_GEMS" ]
|
||||||
|
then
|
||||||
read -r -a REMOTE_GEMS <<< "$(gem list --remote --no-versions | sed 's/\*\*\* REMOTE GEMS \*\*\*//' | tr '\n' ' ')"
|
read -r -a REMOTE_GEMS <<< "$(gem list --remote --no-versions | sed 's/\*\*\* REMOTE GEMS \*\*\*//' | tr '\n' ' ')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,15 @@
|
||||||
_command_exists git || return
|
_command_exists git || return
|
||||||
|
|
||||||
# Don't handle completion if it's already managed
|
# Don't handle completion if it's already managed
|
||||||
if complete -p git &> /dev/null; then
|
if complete -p git &> /dev/null
|
||||||
|
then
|
||||||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion"
|
_log_warning "completion already loaded - this usually means it is safe to stop using this completion"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_git_bash_completion_xcrun_git=
|
_git_bash_completion_xcrun_git=
|
||||||
if _command_exists xcrun; then
|
if _command_exists xcrun
|
||||||
|
then
|
||||||
_git_bash_completion_xcrun_git="$(xcrun --find git)"
|
_git_bash_completion_xcrun_git="$(xcrun --find git)"
|
||||||
fi
|
fi
|
||||||
_git_bash_completion_paths=(
|
_git_bash_completion_paths=(
|
||||||
|
|
@ -27,7 +29,8 @@ _git_bash_completion_paths=(
|
||||||
# Load the first completion file found
|
# Load the first completion file found
|
||||||
_git_bash_completion_found=false
|
_git_bash_completion_found=false
|
||||||
for _comp_path in "${_git_bash_completion_paths[@]}"; do
|
for _comp_path in "${_git_bash_completion_paths[@]}"; do
|
||||||
if [[ -r "$_comp_path" ]]; then
|
if [[ -r "$_comp_path" ]]
|
||||||
|
then
|
||||||
_git_bash_completion_found=true
|
_git_bash_completion_found=true
|
||||||
# shellcheck disable=SC1090 # don't follow
|
# shellcheck disable=SC1090 # don't follow
|
||||||
source "$_comp_path"
|
source "$_comp_path"
|
||||||
|
|
@ -36,7 +39,8 @@ for _comp_path in "${_git_bash_completion_paths[@]}"; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
if [[ "${_git_bash_completion_found}" == false ]]; then
|
if [[ "${_git_bash_completion_found}" == false ]]
|
||||||
|
then
|
||||||
_log_warning "no completion files found - please try enabling the 'system' completion instead."
|
_log_warning "no completion files found - please try enabling the 'system' completion instead."
|
||||||
fi
|
fi
|
||||||
unset "${!_git_bash_completion@}"
|
unset "${!_git_bash_completion@}"
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,12 @@
|
||||||
#
|
#
|
||||||
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
|
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)
|
||||||
|
|
||||||
_git_flow ()
|
function _git_flow ()
|
||||||
{
|
{
|
||||||
local subcommands="init feature release hotfix"
|
local subcommands="init feature release hotfix"
|
||||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
local subcommand="$(__git_find_subcommand "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -73,11 +74,12 @@ _git_flow ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_feature ()
|
function __git_flow_feature ()
|
||||||
{
|
{
|
||||||
local subcommands="list start finish publish track diff rebase checkout pull"
|
local subcommands="list start finish publish track diff rebase checkout pull"
|
||||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
local subcommand="$(__git_find_subcommand "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -105,26 +107,27 @@ __git_flow_feature ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_list_features ()
|
function __git_flow_list_features ()
|
||||||
{
|
{
|
||||||
git flow feature list 2> /dev/null | tr -d ' |*'
|
git flow feature list 2> /dev/null | tr -d ' |*'
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_list_remote_features ()
|
function __git_flow_list_remote_features ()
|
||||||
{
|
{
|
||||||
git branch -r 2> /dev/null | grep "origin/$(__git_flow_feature_prefix)" | awk '{ sub(/^origin\/$(__git_flow_feature_prefix)/, "", $1); print }'
|
git branch -r 2> /dev/null | grep "origin/$(__git_flow_feature_prefix)" | awk '{ sub(/^origin\/$(__git_flow_feature_prefix)/, "", $1); print }'
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_feature_prefix ()
|
function __git_flow_feature_prefix ()
|
||||||
{
|
{
|
||||||
git config gitflow.prefix.feature 2> /dev/null || echo "feature/"
|
git config gitflow.prefix.feature 2> /dev/null || echo "feature/"
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_release ()
|
function __git_flow_release ()
|
||||||
{
|
{
|
||||||
local subcommands="list start finish"
|
local subcommands="list start finish"
|
||||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
local subcommand="$(__git_find_subcommand "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -141,16 +144,17 @@ __git_flow_release ()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_list_releases ()
|
function __git_flow_list_releases ()
|
||||||
{
|
{
|
||||||
git flow release list 2> /dev/null
|
git flow release list 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_hotfix ()
|
function __git_flow_hotfix ()
|
||||||
{
|
{
|
||||||
local subcommands="list start finish"
|
local subcommands="list start finish"
|
||||||
local subcommand="$(__git_find_subcommand "$subcommands")"
|
local subcommand="$(__git_find_subcommand "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -166,7 +170,7 @@ __git_flow_hotfix ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_list_hotfixes ()
|
function __git_flow_list_hotfixes ()
|
||||||
{
|
{
|
||||||
git flow hotfix list 2> /dev/null
|
git flow hotfix list 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,12 @@ __git_flow_config_file_options="
|
||||||
--local --global --system --file=
|
--local --global --system --file=
|
||||||
"
|
"
|
||||||
|
|
||||||
_git_flow ()
|
function _git_flow ()
|
||||||
{
|
{
|
||||||
local subcommands="init feature release hotfix support help version config finish delete publish rebase"
|
local subcommands="init feature release hotfix support help version config finish delete publish rebase"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -93,11 +94,12 @@ _git_flow ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_init ()
|
function __git_flow_init ()
|
||||||
{
|
{
|
||||||
local subcommands="help"
|
local subcommands="help"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -113,12 +115,13 @@ __git_flow_init ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_feature ()
|
function __git_flow_feature ()
|
||||||
{
|
{
|
||||||
local subcommands="list start finish publish track diff rebase checkout pull help delete"
|
local subcommands="list start finish publish track diff rebase checkout pull help delete"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
|
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -196,11 +199,12 @@ __git_flow_feature ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_release ()
|
function __git_flow_release ()
|
||||||
{
|
{
|
||||||
local subcommands="list start finish track publish help delete"
|
local subcommands="list start finish track publish help delete"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -282,11 +286,12 @@ __git_flow_release ()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_hotfix ()
|
function __git_flow_hotfix ()
|
||||||
{
|
{
|
||||||
local subcommands="list start finish track publish help delete"
|
local subcommands="list start finish track publish help delete"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -366,11 +371,12 @@ __git_flow_hotfix ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_support ()
|
function __git_flow_support ()
|
||||||
{
|
{
|
||||||
local subcommands="list start help"
|
local subcommands="list start help"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -406,11 +412,12 @@ __git_flow_support ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_config ()
|
function __git_flow_config ()
|
||||||
{
|
{
|
||||||
local subcommands="list set base"
|
local subcommands="list set base"
|
||||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||||
if [ -z "$subcommand" ]; then
|
if [ -z "$subcommand" ]
|
||||||
|
then
|
||||||
__gitcomp "$subcommands"
|
__gitcomp "$subcommands"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
@ -450,9 +457,9 @@ __git_flow_config ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_prefix ()
|
function __git_flow_prefix ()
|
||||||
{
|
{
|
||||||
case "$1" in
|
case "${1}" in
|
||||||
feature|release|hotfix|support)
|
feature|release|hotfix|support)
|
||||||
git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/"
|
git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/"
|
||||||
return
|
return
|
||||||
|
|
@ -460,9 +467,10 @@ __git_flow_prefix ()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_list_local_branches ()
|
function __git_flow_list_local_branches ()
|
||||||
{
|
{
|
||||||
if [ -n "$1" ]; then
|
if [ -n "${1}" ]
|
||||||
|
then
|
||||||
local prefix="$(__git_flow_prefix $1)"
|
local prefix="$(__git_flow_prefix $1)"
|
||||||
git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix | \
|
git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix | \
|
||||||
while read -r entry; do
|
while read -r entry; do
|
||||||
|
|
@ -476,7 +484,7 @@ __git_flow_list_local_branches ()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_list_remote_branches ()
|
function __git_flow_list_remote_branches ()
|
||||||
{
|
{
|
||||||
local prefix="$(__git_flow_prefix $1)"
|
local prefix="$(__git_flow_prefix $1)"
|
||||||
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
|
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
|
||||||
|
|
@ -488,10 +496,11 @@ __git_flow_list_remote_branches ()
|
||||||
done | sort
|
done | sort
|
||||||
}
|
}
|
||||||
|
|
||||||
__git_flow_list_branches ()
|
function __git_flow_list_branches ()
|
||||||
{
|
{
|
||||||
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
|
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
|
||||||
if [ -n "$1" ]; then
|
if [ -n "${1}" ]
|
||||||
|
then
|
||||||
local prefix="$(__git_flow_prefix $1)"
|
local prefix="$(__git_flow_prefix $1)"
|
||||||
git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix refs/remotes/$origin/$prefix | \
|
git for-each-ref --shell --format="ref=%(refname:short)" refs/heads/$prefix refs/remotes/$origin/$prefix | \
|
||||||
while read -r entry; do
|
while read -r entry; do
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "GitHub CLI completion"
|
about-completion "GitHub CLI completion"
|
||||||
|
|
||||||
if _binary_exists gh; then
|
if _binary_exists gh
|
||||||
|
then
|
||||||
# If gh already completed, stop
|
# If gh already completed, stop
|
||||||
_completion_exists gh && return
|
_completion_exists gh && return
|
||||||
eval "$(gh completion --shell=bash)"
|
eval "$(gh completion --shell=bash)"
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@ about-completion "completion for go command using gocomplete"
|
||||||
|
|
||||||
# Test `go version` because goenv creates shim scripts that will be found in PATH
|
# Test `go version` because goenv creates shim scripts that will be found in PATH
|
||||||
# but do not always resolve to a working install.
|
# but do not always resolve to a working install.
|
||||||
if _command_exists go && go version &> /dev/null; then
|
if _command_exists go && go version &> /dev/null
|
||||||
|
then
|
||||||
# Same idea here, but no need to test a subcommand
|
# Same idea here, but no need to test a subcommand
|
||||||
if _command_exists gocomplete && gocomplete &> /dev/null; then
|
if _command_exists gocomplete && gocomplete &> /dev/null
|
||||||
|
then
|
||||||
# finally, apply completion
|
# finally, apply completion
|
||||||
complete -C gocomplete go
|
complete -C gocomplete go
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -24,56 +24,102 @@
|
||||||
# Avoid inaccurate completions for subproject tasks
|
# Avoid inaccurate completions for subproject tasks
|
||||||
COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g')
|
COMP_WORDBREAKS=$(echo "$COMP_WORDBREAKS" | sed -e 's/://g')
|
||||||
|
|
||||||
function __gradle-set-project-root-dir() {
|
function __gradle-set-project-root-dir()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
project_root_dir="$(_bash-it-find-in-ancestor "settings.gradle" "gradlew")"
|
project_root_dir="$(_bash-it-find-in-ancestor "settings.gradle" "gradlew")"
|
||||||
return "$?"
|
return "${?}"
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-init-cache-dir() {
|
function __gradle-init-cache-dir()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
cache_dir="$HOME/.gradle/completion"
|
cache_dir="$HOME/.gradle/completion"
|
||||||
mkdir -p $cache_dir
|
mkdir -p ${cache_dir}
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-set-build-file() {
|
function __gradle-set-build-file()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
# Look for default build script in the settings file (settings.gradle by default)
|
# Look for default build script in the settings file (settings.gradle by default)
|
||||||
# Otherwise, default is the file 'build.gradle' in the current directory.
|
# Otherwise, default is the file 'build.gradle' in the current directory.
|
||||||
gradle_build_file="$project_root_dir/build.gradle"
|
gradle_build_file="$project_root_dir/build.gradle"
|
||||||
if [[ -f "$project_root_dir/settings.gradle" ]]; then
|
if [[ -f "$project_root_dir/settings.gradle" ]]
|
||||||
|
then
|
||||||
local build_file_name=$(grep "^rootProject\.buildFileName" "$project_root_dir/settings.gradle" | \
|
local build_file_name=$(grep "^rootProject\.buildFileName" "$project_root_dir/settings.gradle" | \
|
||||||
sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")
|
sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")
|
||||||
gradle_build_file="$project_root_dir/${build_file_name:-build.gradle}"
|
gradle_build_file="$project_root_dir/${build_file_name:-build.gradle}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-set-cache-name() {
|
function __gradle-set-cache-name()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
# Cache name is constructed from the absolute path of the build file.
|
# Cache name is constructed from the absolute path of the build file.
|
||||||
cache_name=$(echo $gradle_build_file | sed -e 's/\//_/g')
|
cache_name=$(echo $gradle_build_file | sed -e 's/\//_/g')
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-set-files-checksum() {
|
function __gradle-set-files-checksum()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
# Cache MD5 sum of all Gradle scripts and modified timestamps
|
# Cache MD5 sum of all Gradle scripts and modified timestamps
|
||||||
if _command_exists md5; then
|
if _command_exists md5
|
||||||
|
then
|
||||||
gradle_files_checksum=$(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)")
|
gradle_files_checksum=$(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)")
|
||||||
elif _command_exists md5sum; then
|
elif _command_exists md5sum
|
||||||
|
then
|
||||||
gradle_files_checksum=$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}')
|
gradle_files_checksum=$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}')
|
||||||
else
|
else
|
||||||
echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH"
|
echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-generate-script-cache() {
|
function __gradle-generate-script-cache()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
# Invalidate cache after 3 weeks by default
|
# Invalidate cache after 3 weeks by default
|
||||||
local cache_ttl_mins=${GRADLE_CACHE_TTL_MINUTES:-30240}
|
local cache_ttl_mins=${GRADLE_CACHE_TTL_MINUTES:-30240}
|
||||||
local script_exclude_pattern=${GRADLE_COMPLETION_EXCLUDE_PATTERN:-"/(build|integTest|out)/"}
|
local script_exclude_pattern=${GRADLE_COMPLETION_EXCLUDE_PATTERN:-"/(build|integTest|out)/"}
|
||||||
|
|
||||||
if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]; then
|
if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]
|
||||||
|
then
|
||||||
# Cache all Gradle scripts
|
# Cache all Gradle scripts
|
||||||
local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern")
|
local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern")
|
||||||
printf "%s\n" "${gradle_build_scripts[@]}" > $cache_dir/$cache_name
|
printf "%s\n" "${gradle_build_scripts[@]}" > $cache_dir/$cache_name
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-long-options() {
|
function __gradle-long-options()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
|
||||||
local args="--build-cache - Enables the Gradle build cache
|
local args="--build-cache - Enables the Gradle build cache
|
||||||
--build-file - Specifies the build file
|
--build-file - Specifies the build file
|
||||||
--configure-on-demand - Only relevant projects are configured
|
--configure-on-demand - Only relevant projects are configured
|
||||||
|
|
@ -118,7 +164,12 @@ __gradle-long-options() {
|
||||||
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
|
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-properties() {
|
function __gradle-properties()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local args="-Dorg.gradle.cache.reserved.mb= - Reserve Gradle Daemon memory for operations
|
local args="-Dorg.gradle.cache.reserved.mb= - Reserve Gradle Daemon memory for operations
|
||||||
-Dorg.gradle.caching= - Set true to enable Gradle build cache
|
-Dorg.gradle.caching= - Set true to enable Gradle build cache
|
||||||
-Dorg.gradle.daemon.debug= - Set true to debug Gradle Daemon
|
-Dorg.gradle.daemon.debug= - Set true to debug Gradle Daemon
|
||||||
|
|
@ -134,7 +185,12 @@ __gradle-properties() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-short-options() {
|
function __gradle-short-options()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local args="-? - Shows a help message
|
local args="-? - Shows a help message
|
||||||
-a - Do not rebuild project dependencies
|
-a - Do not rebuild project dependencies
|
||||||
-b - Specifies the build file
|
-b - Specifies the build file
|
||||||
|
|
@ -159,7 +215,12 @@ __gradle-short-options() {
|
||||||
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
|
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-notify-tasks-cache-build() {
|
function __gradle-notify-tasks-cache-build()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
# Notify user of cache rebuild
|
# Notify user of cache rebuild
|
||||||
echo -e " (Building completion cache. Please wait)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
|
echo -e " (Building completion cache. Please wait)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
|
||||||
__gradle-generate-tasks-cache
|
__gradle-generate-tasks-cache
|
||||||
|
|
@ -167,22 +228,29 @@ __gradle-notify-tasks-cache-build() {
|
||||||
echo -e " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
|
echo -e " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-generate-tasks-cache() {
|
function __gradle-generate-tasks-cache()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
__gradle-set-files-checksum
|
__gradle-set-files-checksum
|
||||||
|
|
||||||
# Use Gradle wrapper when it exists.
|
# Use Gradle wrapper when it exists.
|
||||||
local gradle_cmd="gradle"
|
local gradle_cmd="gradle"
|
||||||
if [[ -x "$project_root_dir/gradlew" ]]; then
|
if [[ -x "${project_root_dir}/gradlew" ]]
|
||||||
gradle_cmd="$project_root_dir/gradlew"
|
then
|
||||||
|
gradle_cmd="${project_root_dir}/gradlew"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run gradle to retrieve possible tasks and cache.
|
# Run gradle to retrieve possible tasks and cache.
|
||||||
# Reuse Gradle Daemon if IDLE but don't start a new one.
|
# Reuse Gradle Daemon if IDLE but don't start a new one.
|
||||||
local gradle_tasks_output
|
local gradle_tasks_output
|
||||||
if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
|
if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]
|
||||||
gradle_tasks_output="$($gradle_cmd -b $gradle_build_file --daemon -q tasks --all)"
|
then
|
||||||
|
gradle_tasks_output="$(${gradle_cmd} -b ${gradle_build_file} --daemon -q tasks --all)"
|
||||||
else
|
else
|
||||||
gradle_tasks_output="$($gradle_cmd -b $gradle_build_file --no-daemon -q tasks --all)"
|
gradle_tasks_output="$(${gradle_cmd} -b ${gradle_build_file} --no-daemon -q tasks --all)"
|
||||||
fi
|
fi
|
||||||
local output_line
|
local output_line
|
||||||
local task_description
|
local task_description
|
||||||
|
|
@ -190,12 +258,14 @@ __gradle-generate-tasks-cache() {
|
||||||
local -a root_tasks=()
|
local -a root_tasks=()
|
||||||
local -a subproject_tasks=()
|
local -a subproject_tasks=()
|
||||||
for output_line in $gradle_tasks_output; do
|
for output_line in $gradle_tasks_output; do
|
||||||
if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
|
if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]
|
||||||
|
then
|
||||||
task_name="${BASH_REMATCH[1]}"
|
task_name="${BASH_REMATCH[1]}"
|
||||||
task_description="${BASH_REMATCH[3]}"
|
task_description="${BASH_REMATCH[3]}"
|
||||||
gradle_all_tasks+=( "$task_name - $task_description" )
|
gradle_all_tasks+=( "$task_name - $task_description" )
|
||||||
# Completion for subproject tasks with ':' prefix
|
# Completion for subproject tasks with ':' prefix
|
||||||
if [[ $task_name =~ ^([[:alnum:][:punct:]]+):([[:alnum:]]+) ]]; then
|
if [[ $task_name =~ ^([[:alnum:][:punct:]]+):([[:alnum:]]+) ]]
|
||||||
|
then
|
||||||
gradle_all_tasks+=( ":$task_name - $task_description" )
|
gradle_all_tasks+=( ":$task_name - $task_description" )
|
||||||
subproject_tasks+=( "${BASH_REMATCH[2]}" )
|
subproject_tasks+=( "${BASH_REMATCH[2]}" )
|
||||||
else
|
else
|
||||||
|
|
@ -205,28 +275,36 @@ __gradle-generate-tasks-cache() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# subproject tasks can be referenced implicitly from root project
|
# subproject tasks can be referenced implicitly from root project
|
||||||
if [[ $GRADLE_COMPLETION_UNQUALIFIED_TASKS == "true" ]]; then
|
if [[ $GRADLE_COMPLETION_UNQUALIFIED_TASKS == "true" ]]
|
||||||
|
then
|
||||||
local -a implicit_tasks=()
|
local -a implicit_tasks=()
|
||||||
implicit_tasks=( $(comm -23 <(printf "%s\n" "${subproject_tasks[@]}" | sort) <(printf "%s\n" "${root_tasks[@]}" | sort)) )
|
implicit_tasks=( $(comm -23 <(printf "%s\n" "${subproject_tasks[@]}" | sort) <(printf "%s\n" "${root_tasks[@]}" | sort)) )
|
||||||
for task in $(printf "%s\n" "${implicit_tasks[@]}"); do
|
for task in $(printf "%s\n" "${implicit_tasks[@]}")
|
||||||
|
do
|
||||||
gradle_all_tasks+=( $task )
|
gradle_all_tasks+=( $task )
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "%s\n" "${gradle_all_tasks[@]}" > $cache_dir/$gradle_files_checksum
|
printf "%s\n" "${gradle_all_tasks[@]}" > ${cache_dir}/${gradle_files_checksum}
|
||||||
echo $gradle_files_checksum > $cache_dir/$cache_name.md5
|
echo ${gradle_files_checksum} > ${cache_dir}/${cache_name}.md5
|
||||||
}
|
}
|
||||||
|
|
||||||
__gradle-completion-init() {
|
function __gradle-completion-init()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
|
local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
|
||||||
|
|
||||||
local OLDIFS="$IFS"
|
local OLDIFS="${IFS}"
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
|
|
||||||
__gradle-init-cache-dir
|
__gradle-init-cache-dir
|
||||||
__gradle-set-project-root-dir
|
__gradle-set-project-root-dir
|
||||||
__gradle-set-build-file
|
__gradle-set-build-file
|
||||||
if [[ -f $gradle_build_file ]]; then
|
if [[ -f ${gradle_build_file} ]]
|
||||||
|
then
|
||||||
__gradle-set-cache-name
|
__gradle-set-cache-name
|
||||||
__gradle-generate-script-cache
|
__gradle-generate-script-cache
|
||||||
__gradle-set-files-checksum
|
__gradle-set-files-checksum
|
||||||
|
|
@ -238,45 +316,57 @@ __gradle-completion-init() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
_gradle() {
|
function _gradle()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
|
local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
|
||||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
# Set bash internal field separator to '\n'
|
# Set bash internal field separator to '\n'
|
||||||
# This allows us to provide descriptions for options and tasks
|
# This allows us to provide descriptions for options and tasks
|
||||||
local OLDIFS="$IFS"
|
local OLDIFS="${IFS}"
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
|
|
||||||
if [[ ${cur} == --* ]]; then
|
if [[ ${cur} == --* ]]
|
||||||
|
then
|
||||||
__gradle-long-options
|
__gradle-long-options
|
||||||
elif [[ ${cur} == -D* ]]; then
|
elif [[ ${cur} == -D* ]]
|
||||||
|
then
|
||||||
__gradle-properties
|
__gradle-properties
|
||||||
elif [[ ${cur} == -* ]]; then
|
elif [[ ${cur} == -* ]]
|
||||||
|
then
|
||||||
__gradle-short-options
|
__gradle-short-options
|
||||||
else
|
else
|
||||||
__gradle-init-cache-dir
|
__gradle-init-cache-dir
|
||||||
__gradle-set-project-root-dir
|
__gradle-set-project-root-dir
|
||||||
__gradle-set-build-file
|
__gradle-set-build-file
|
||||||
if [[ -f $gradle_build_file ]]; then
|
if [[ -f ${gradle_build_file} ]]
|
||||||
|
then
|
||||||
__gradle-set-cache-name
|
__gradle-set-cache-name
|
||||||
__gradle-generate-script-cache
|
__gradle-generate-script-cache
|
||||||
__gradle-set-files-checksum
|
__gradle-set-files-checksum
|
||||||
|
|
||||||
# The cache key is md5 sum of all gradle scripts, so it's valid if it exists.
|
# The cache key is md5 sum of all gradle scripts, so it's valid if it exists.
|
||||||
if [[ -f $cache_dir/$cache_name.md5 ]]; then
|
if [[ -f ${cache_dir}/${cache_name}.md5 ]]
|
||||||
local cached_checksum="$(cat $cache_dir/$cache_name.md5)"
|
then
|
||||||
|
local cached_checksum="$(cat ${cache_dir}/${cache_name}.md5)"
|
||||||
local -a cached_tasks
|
local -a cached_tasks
|
||||||
if [[ -z $cur ]]; then
|
if [[ -z ${cur} ]]
|
||||||
cached_tasks=( $(cat $cache_dir/$cached_checksum) )
|
then
|
||||||
|
cached_tasks=( $(cat ${cache_dir}/${cached_checksum}) )
|
||||||
else
|
else
|
||||||
cached_tasks=( $(grep "^$cur" $cache_dir/$cached_checksum) )
|
cached_tasks=( $(grep "^${cur}" ${cache_dir}/${cached_checksum}) )
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( $(compgen -W "${cached_tasks[*]}" -- "$cur") )
|
COMPREPLY=( $(compgen -W "${cached_tasks[*]}" -- "${cur}") )
|
||||||
else
|
else
|
||||||
__gradle-notify-tasks-cache-build
|
__gradle-notify-tasks-cache-build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Regenerate tasks cache in the background
|
# Regenerate tasks cache in the background
|
||||||
if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum ]]; then
|
if [[ ${gradle_files_checksum} != "$(cat ${cache_dir}/$cache_name.md5)" || ! -f ${cache_dir}/${gradle_files_checksum} ]]
|
||||||
|
then
|
||||||
$(__gradle-generate-tasks-cache 1>&2 2>/dev/null &)
|
$(__gradle-generate-tasks-cache 1>&2 2>/dev/null &)
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
@ -300,12 +390,14 @@ wrapper - Generates Gradle wrapper files."
|
||||||
IFS="$OLDIFS"
|
IFS="$OLDIFS"
|
||||||
|
|
||||||
# Remove description ("[:space:]" and after) if only one possibility
|
# Remove description ("[:space:]" and after) if only one possibility
|
||||||
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then
|
if [[ ${#COMPREPLY[*]} -eq 1 ]]
|
||||||
|
then
|
||||||
COMPREPLY=( ${COMPREPLY[0]%% *} )
|
COMPREPLY=( ${COMPREPLY[0]%% *} )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -F _gradle gradle
|
complete -F _gradle gradle
|
||||||
complete -F _gradle gradle.bat
|
complete -F _gradle gradle.bat
|
||||||
complete -F _gradle gradlew
|
complete -F _gradle gradlew
|
||||||
|
|
@ -313,6 +405,7 @@ complete -F _gradle gradlew.bat
|
||||||
complete -F _gradle ./gradlew
|
complete -F _gradle ./gradlew
|
||||||
complete -F _gradle ./gradlew.bat
|
complete -F _gradle ./gradlew.bat
|
||||||
|
|
||||||
if hash gw 2>/dev/null || alias gw >/dev/null 2>&1; then
|
if hash gw 2>/dev/null || alias gw >/dev/null 2>&1
|
||||||
|
then
|
||||||
complete -F _gradle gw
|
complete -F _gradle gw
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,8 @@ function _grunt_gruntfile() {
|
||||||
local curpath="$PWD"
|
local curpath="$PWD"
|
||||||
while [[ "$curpath" ]]; do
|
while [[ "$curpath" ]]; do
|
||||||
for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do
|
for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do
|
||||||
if [[ -e "$gruntfile" ]]; then
|
if [[ -e "$gruntfile" ]]
|
||||||
|
then
|
||||||
echo "$gruntfile"
|
echo "$gruntfile"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "helm (Kubernetes Package Manager) completion"
|
about-completion "helm (Kubernetes Package Manager) completion"
|
||||||
|
|
||||||
if _command_exists helm; then
|
if _command_exists helm
|
||||||
|
then
|
||||||
eval "$(helm completion bash)"
|
eval "$(helm completion bash)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,14 @@
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
# If there is no git tab completion, but we have the _completion loader try to load it
|
# If there is no git tab completion, but we have the _completion loader try to load it
|
||||||
if ! _is_function _git && _is_function _completion_loader; then
|
if ! _is_function _git && _is_function _completion_loader
|
||||||
|
then
|
||||||
_completion_loader git
|
_completion_loader git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check that git tab completion is available and we haven't already set up completion
|
# Check that git tab completion is available and we haven't already set up completion
|
||||||
if _is_function _git && ! _is_function __git_list_all_commands_without_hub; then
|
if _is_function _git && ! _is_function __git_list_all_commands_without_hub
|
||||||
|
then
|
||||||
# Duplicate and rename the 'list_all_commands' function
|
# Duplicate and rename the 'list_all_commands' function
|
||||||
eval "$(declare -f __git_list_all_commands | \
|
eval "$(declare -f __git_list_all_commands | \
|
||||||
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
|
||||||
|
|
@ -60,17 +62,25 @@ EOF
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
# hub alias [-s] [SHELL]
|
# hub alias [-s] [SHELL]
|
||||||
_git_alias() {
|
function _git_alias()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local i c=2 s=-s sh shells="bash zsh sh ksh csh fish"
|
local i c=2 s=-s sh shells="bash zsh sh ksh csh fish"
|
||||||
while [ $c -lt $cword ]; do
|
while [ $c -lt $cword ]
|
||||||
|
do
|
||||||
i="${words[c]}"
|
i="${words[c]}"
|
||||||
case "$i" in
|
case "$i" in
|
||||||
-s)
|
-s)
|
||||||
unset s
|
unset s
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
for sh in $shells; do
|
for sh in ${shells}
|
||||||
if [ "$sh" = "$i" ]; then
|
do
|
||||||
|
if [ "$sh" = "$i" ]
|
||||||
|
then
|
||||||
unset shells
|
unset shells
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
@ -79,35 +89,44 @@ EOF
|
||||||
esac
|
esac
|
||||||
((c++))
|
((c++))
|
||||||
done
|
done
|
||||||
__gitcomp "$s $shells"
|
__gitcomp "$s ${shells}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
|
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
|
||||||
_git_browse() {
|
function _git_browse()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local i c=2 u=-u repo subpage
|
local i c=2 u=-u repo subpage
|
||||||
local subpages_="commits issues tree wiki pulls branches stargazers
|
local subpages_="commits issues tree wiki pulls branches stargazers
|
||||||
contributors network network/ graphs graphs/"
|
contributors network network/ graphs graphs/"
|
||||||
local subpages_network="members"
|
local subpages_network="members"
|
||||||
local subpages_graphs="commit-activity code-frequency punch-card"
|
local subpages_graphs="commit-activity code-frequency punch-card"
|
||||||
while [ $c -lt $cword ]; do
|
while [ $c -lt $cword ]
|
||||||
|
do
|
||||||
i="${words[c]}"
|
i="${words[c]}"
|
||||||
case "$i" in
|
case "$i" in
|
||||||
-u)
|
-u)
|
||||||
unset u
|
unset u
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -z "$repo" ]; then
|
if [ -z "${repo}" ]
|
||||||
repo=$i
|
then
|
||||||
|
repo=${i}
|
||||||
else
|
else
|
||||||
subpage=$i
|
subpage=${i}
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
((c++))
|
((c++))
|
||||||
done
|
done
|
||||||
if [ -z "$repo" ]; then
|
if [ -z "${repo}" ]
|
||||||
|
then
|
||||||
__gitcomp "$u -- $(__hub_github_repos '\p')"
|
__gitcomp "$u -- $(__hub_github_repos '\p')"
|
||||||
elif [ -z "$subpage" ]; then
|
elif [ -z "${subpage}" ]
|
||||||
|
then
|
||||||
case "$cur" in
|
case "$cur" in
|
||||||
*/*)
|
*/*)
|
||||||
local pfx="${cur%/*}" cur_="${cur#*/}"
|
local pfx="${cur%/*}" cur_="${cur#*/}"
|
||||||
|
|
@ -124,29 +143,38 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# hub compare [-u] [USER[/REPOSITORY]] [[START...]END]
|
# hub compare [-u] [USER[/REPOSITORY]] [[START...]END]
|
||||||
_git_compare() {
|
function _git_compare()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local i c=$((cword - 1)) u=-u user remote owner repo arg_repo rev
|
local i c=$((cword - 1)) u=-u user remote owner repo arg_repo rev
|
||||||
while [ $c -gt 1 ]; do
|
while [ $c -gt 1 ]
|
||||||
|
do
|
||||||
i="${words[c]}"
|
i="${words[c]}"
|
||||||
case "$i" in
|
case "$i" in
|
||||||
-u)
|
-u)
|
||||||
unset u
|
unset u
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -z "$rev" ]; then
|
if [ -z "$rev" ]
|
||||||
|
then
|
||||||
# Even though the logic below is able to complete both user/repo
|
# Even though the logic below is able to complete both user/repo
|
||||||
# and revision in the right place, when there is only one argument
|
# and revision in the right place, when there is only one argument
|
||||||
# (other than -u) in the command, that argument will be taken as
|
# (other than -u) in the command, that argument will be taken as
|
||||||
# revision. For example:
|
# revision. For example:
|
||||||
# $ hub compare -u upstream
|
# $ hub compare -u upstream
|
||||||
# > https://github.com/USER/REPO/compare/upstream
|
# > https://github.com/USER/REPO/compare/upstream
|
||||||
if __hub_github_repos '\p' | grep -Eqx "^$i(/[^/]+)?"; then
|
if __hub_github_repos '\p' | grep -Eqx "^$i(/[^/]+)?"
|
||||||
arg_repo=$i
|
then
|
||||||
|
arg_repo=${i}
|
||||||
else
|
else
|
||||||
rev=$i
|
rev=$i
|
||||||
fi
|
fi
|
||||||
elif [ -z "$arg_repo" ]; then
|
elif [ -z "${arg_repo}" ]
|
||||||
arg_repo=$i
|
then
|
||||||
|
arg_repo=${i}
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -155,28 +183,35 @@ EOF
|
||||||
|
|
||||||
# Here we want to find out the git remote name of user/repo, in order to
|
# Here we want to find out the git remote name of user/repo, in order to
|
||||||
# generate an appropriate revision list
|
# generate an appropriate revision list
|
||||||
if [ -z "$arg_repo" ]; then
|
if [ -z "$arg_repo" ]
|
||||||
|
then
|
||||||
user=$(__hub_github_user)
|
user=$(__hub_github_user)
|
||||||
if [ -z "$user" ]; then
|
if [ -z "$user" ]
|
||||||
for i in $(__hub_github_repos); do
|
then
|
||||||
|
for i in $(__hub_github_repos)
|
||||||
|
do
|
||||||
remote=${i%%:*}
|
remote=${i%%:*}
|
||||||
repo=${i#*:}
|
repo=${i#*:}
|
||||||
if [ "$remote" = origin ]; then
|
if [ "$remote" = origin ]
|
||||||
|
then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
for i in $(__hub_github_repos); do
|
for i in $(__hub_github_repos)
|
||||||
|
do
|
||||||
remote=${i%%:*}
|
remote=${i%%:*}
|
||||||
repo=${i#*:}
|
repo=${i#*:}
|
||||||
owner=${repo%%/*}
|
owner=${repo%%/*}
|
||||||
if [ "$user" = "$owner" ]; then
|
if [ "$user" = "$owner" ]
|
||||||
|
then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
for i in $(__hub_github_repos); do
|
for i in $(__hub_github_repos)
|
||||||
|
do
|
||||||
remote=${i%%:*}
|
remote=${i%%:*}
|
||||||
repo=${i#*:}
|
repo=${i#*:}
|
||||||
owner=${repo%%/*}
|
owner=${repo%%/*}
|
||||||
|
|
@ -188,18 +223,20 @@ EOF
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local pfx cur_="$cur"
|
local pfx cur_="${cur}"
|
||||||
case "$cur_" in
|
case "${cur_}" in
|
||||||
*..*)
|
*..*)
|
||||||
pfx="${cur_%%..*}..."
|
pfx="${cur_%%..*}..."
|
||||||
cur_="${cur_##*..}"
|
cur_="${cur_##*..}"
|
||||||
__gitcomp_nl "$(__hub_revlist $remote)" "$pfx" "$cur_"
|
__gitcomp_nl "$(__hub_revlist ${remote})" "${pfx}" "${cur_}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -z "${arg_repo}${rev}" ]; then
|
if [ -z "${arg_repo}${rev}" ]
|
||||||
__gitcomp "$u $(__hub_github_repos '\o\n\p') $(__hub_revlist $remote)"
|
then
|
||||||
elif [ -z "$rev" ]; then
|
__gitcomp "$u $(__hub_github_repos '\o\n\p') $(__hub_revlist ${remote})"
|
||||||
__gitcomp "$u $(__hub_revlist $remote)"
|
elif [ -z "$rev" ]
|
||||||
|
then
|
||||||
|
__gitcomp "$u $(__hub_revlist ${remote})"
|
||||||
else
|
else
|
||||||
__gitcomp "$u"
|
__gitcomp "$u"
|
||||||
fi
|
fi
|
||||||
|
|
@ -208,9 +245,15 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
|
# hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
|
||||||
_git_create() {
|
function _git_create()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local i c=2 name repo flags="-p -d -h"
|
local i c=2 name repo flags="-p -d -h"
|
||||||
while [ $c -lt $cword ]; do
|
while [ $c -lt $cword ]
|
||||||
|
do
|
||||||
i="${words[c]}"
|
i="${words[c]}"
|
||||||
case "$i" in
|
case "$i" in
|
||||||
-d|-h)
|
-d|-h)
|
||||||
|
|
@ -226,7 +269,8 @@ EOF
|
||||||
esac
|
esac
|
||||||
((c++))
|
((c++))
|
||||||
done
|
done
|
||||||
if [ -z "$name" ]; then
|
if [ -z "$name" ]
|
||||||
|
then
|
||||||
repo="$(basename "${PWD}")"
|
repo="$(basename "${PWD}")"
|
||||||
fi
|
fi
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
|
|
@ -234,15 +278,21 @@ EOF
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
;;
|
;;
|
||||||
-p|*)
|
-p|*)
|
||||||
__gitcomp "$repo $flags"
|
__gitcomp "${repo} ${flags}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# hub fork [--no-remote] [--remote-name REMOTE] [--org ORGANIZATION]
|
# hub fork [--no-remote] [--remote-name REMOTE] [--org ORGANIZATION]
|
||||||
_git_fork() {
|
function _git_fork()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local i c=2 flags="--no-remote --remote-name --org"
|
local i c=2 flags="--no-remote --remote-name --org"
|
||||||
while [ $c -lt $cword ]; do
|
while [ $c -lt ${cword} ]
|
||||||
|
do
|
||||||
i="${words[c]}"
|
i="${words[c]}"
|
||||||
case "$i" in
|
case "$i" in
|
||||||
--org)
|
--org)
|
||||||
|
|
@ -261,20 +311,26 @@ EOF
|
||||||
esac
|
esac
|
||||||
((c++))
|
((c++))
|
||||||
done
|
done
|
||||||
case "$prev" in
|
case "${prev}" in
|
||||||
--remote-name|--org)
|
--remote-name|--org)
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
__gitcomp "$flags"
|
__gitcomp "${flags}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>]
|
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>]
|
||||||
_git_pull_request() {
|
fucntion _git_pull_request()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local i c=2 flags="-f -m -F -i -b -h -a -M -l"
|
local i c=2 flags="-f -m -F -i -b -h -a -M -l"
|
||||||
while [ $c -lt $cword ]; do
|
while [ $c -lt ${cword} ]
|
||||||
|
do
|
||||||
i="${words[c]}"
|
i="${words[c]}"
|
||||||
case "$i" in
|
case "$i" in
|
||||||
-m|-F|-i|-b|-h|-a|-M|-l)
|
-m|-F|-i|-b|-h|-a|-M|-l)
|
||||||
|
|
@ -299,10 +355,10 @@ EOF
|
||||||
# __ltrim_colon_completions "$cur"
|
# __ltrim_colon_completions "$cur"
|
||||||
;;
|
;;
|
||||||
-F)
|
-F)
|
||||||
COMPREPLY=( "$cur"* )
|
COMPREPLY=( "${cur}"* )
|
||||||
;;
|
;;
|
||||||
-f|*)
|
-f|*)
|
||||||
__gitcomp "$flags"
|
__gitcomp "${flags}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
@ -314,21 +370,32 @@ EOF
|
||||||
# __hub_github_user [HOST]
|
# __hub_github_user [HOST]
|
||||||
# Return $GITHUB_USER or the default github user defined in hub config
|
# Return $GITHUB_USER or the default github user defined in hub config
|
||||||
# HOST - Host to be looked-up in hub config. Default is "github.com"
|
# HOST - Host to be looked-up in hub config. Default is "github.com"
|
||||||
__hub_github_user() {
|
function __hub_github_user()
|
||||||
if [ -n "$GITHUB_USER" ]; then
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
if [ -n "$GITHUB_USER" ]
|
||||||
|
then
|
||||||
echo $GITHUB_USER
|
echo $GITHUB_USER
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
local line h k v host=${1:-github.com} config=${HUB_CONFIG:-~/.config/hub}
|
local line h k v host=${1:-github.com} config=${HUB_CONFIG:-~/.config/hub}
|
||||||
if [ -f "$config" ]; then
|
if [ -f "$config" ]
|
||||||
while read line; do
|
then
|
||||||
if [ "$line" = "---" ]; then
|
while read line
|
||||||
|
do
|
||||||
|
if [ "$line" = "---" ]
|
||||||
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
k=${line%%:*}
|
k=${line%%:*}
|
||||||
v=${line#*:}
|
v=${line#*:}
|
||||||
if [ -z "$v" ]; then
|
if [ -z "$v" ]
|
||||||
if [ "$h" = "$host" ]; then
|
then
|
||||||
|
if [ "$h" = "$host" ]
|
||||||
|
then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
h=$k
|
h=$k
|
||||||
|
|
@ -336,11 +403,12 @@ EOF
|
||||||
fi
|
fi
|
||||||
k=${k#* }
|
k=${k#* }
|
||||||
v=${v#* }
|
v=${v#* }
|
||||||
if [ "$h" = "$host" ] && [ "$k" = "user" ]; then
|
if [ "$h" = "$host" ] && [ "$k" = "user" ]
|
||||||
|
then
|
||||||
echo "$v"
|
echo "$v"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done < "$config"
|
done < "${config}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,12 +420,19 @@ EOF
|
||||||
# \o owner
|
# \o owner
|
||||||
# escaped characters (\n, \t ...etc) work
|
# escaped characters (\n, \t ...etc) work
|
||||||
# If omitted, prints all github repos in the format of "remote:owner/repo"
|
# If omitted, prints all github repos in the format of "remote:owner/repo"
|
||||||
__hub_github_repos() {
|
function __hub_github_repos()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local f format=$1
|
local f format=$1
|
||||||
if [ -z "$(__gitdir)" ]; then
|
if [ -z "$(__gitdir)" ]
|
||||||
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ -z "$format" ]; then
|
if [ -z "$format" ]
|
||||||
|
then
|
||||||
format='\1:\2'
|
format='\1:\2'
|
||||||
else
|
else
|
||||||
format=${format//\m/\1}
|
format=${format//\m/\1}
|
||||||
|
|
@ -371,16 +446,24 @@ EOF
|
||||||
|
|
||||||
# __hub_heads
|
# __hub_heads
|
||||||
# List all local "branch", and remote "owner/repo:branch"
|
# List all local "branch", and remote "owner/repo:branch"
|
||||||
__hub_heads() {
|
function __hub_heads()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local i remote repo branch dir=$(__gitdir)
|
local i remote repo branch dir=$(__gitdir)
|
||||||
if [ -d "$dir" ]; then
|
if [ -d "$dir" ]
|
||||||
|
then
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||||
"refs/heads/"
|
"refs/heads/"
|
||||||
for i in $(__hub_github_repos); do
|
for i in $(__hub_github_repos)
|
||||||
|
do
|
||||||
remote=${i%%:*}
|
remote=${i%%:*}
|
||||||
repo=${i#*:}
|
repo=${i#*:}
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||||
"refs/remotes/${remote}/" | while read branch; do
|
"refs/remotes/${remote}/" | while read branch
|
||||||
|
do
|
||||||
echo "${repo}:${branch#${remote}/}"
|
echo "${repo}:${branch#${remote}/}"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
@ -390,11 +473,18 @@ EOF
|
||||||
# __hub_revlist [REMOTE]
|
# __hub_revlist [REMOTE]
|
||||||
# List all tags, and branches under REMOTE, without the "remote/" prefix
|
# List all tags, and branches under REMOTE, without the "remote/" prefix
|
||||||
# REMOTE - Remote name to search branches from. Default is "origin"
|
# REMOTE - Remote name to search branches from. Default is "origin"
|
||||||
__hub_revlist() {
|
function __hub_revlist()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local i remote=${1:-origin} dir=$(__gitdir)
|
local i remote=${1:-origin} dir=$(__gitdir)
|
||||||
if [ -d "$dir" ]; then
|
if [ -d "$dir" ]
|
||||||
|
then
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||||
"refs/remotes/${remote}/" | while read i; do
|
"refs/remotes/${remote}/" | while read i
|
||||||
|
do
|
||||||
echo "${i#${remote}/}"
|
echo "${i#${remote}/}"
|
||||||
done
|
done
|
||||||
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,12 @@
|
||||||
|
|
||||||
# https://github.com/pyinvoke/invoke/blob/master/completion/bash
|
# https://github.com/pyinvoke/invoke/blob/master/completion/bash
|
||||||
|
|
||||||
_complete_invoke() {
|
funciton _complete_invoke()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local candidates
|
local candidates
|
||||||
|
|
||||||
# COMP_WORDS contains the entire command string up til now (including
|
# COMP_WORDS contains the entire command string up til now (including
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "jungle(AWS cli tool) completion"
|
about-completion "jungle(AWS cli tool) completion"
|
||||||
|
|
||||||
if _command_exists jungle; then
|
if _command_exists jungle
|
||||||
|
then
|
||||||
eval "$(_JUNGLE_COMPLETE=source jungle)"
|
eval "$(_JUNGLE_COMPLETE=source jungle)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if _command_exists kind; then
|
if _command_exists kind
|
||||||
|
then
|
||||||
eval "$(kind completion bash)"
|
eval "$(kind completion bash)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -33,20 +33,27 @@ stat -c %Y /dev/null > /dev/null 2>&1 && _KAC_STAT_COMMAND="stat -c %Y" || _KAC_
|
||||||
# returns 0 iff the file whose path is given as 1st argument
|
# returns 0 iff the file whose path is given as 1st argument
|
||||||
# exists and has last been modified in the last $2 seconds
|
# exists and has last been modified in the last $2 seconds
|
||||||
# returns 1 otherwise
|
# returns 1 otherwise
|
||||||
_KAC_is_file_newer_than() {
|
function _KAC_is_file_newer_than()
|
||||||
[ -f "$1" ] || return 1
|
{
|
||||||
[ $(($(date +%s) - $($_KAC_STAT_COMMAND "$1"))) -gt "$2" ] && return 1 || return 0
|
[ -f "${1}" ] || return 1
|
||||||
|
[ $(($(date +%s) - $($_KAC_STAT_COMMAND "${1}"))) -gt "${2}" ] && return 1 || return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# helper function for _KAC_get_and_regen_cache, see doc below
|
# helper function for _KAC_get_and_regen_cache, see doc below
|
||||||
_KAC_regen_cache() {
|
function _KAC_regen_cache()
|
||||||
local CACHE_NAME=$1
|
{
|
||||||
local CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
local CACHE_NAME="${1}"
|
||||||
|
local CACHE_PATH="${_KNIFE_AUTOCOMPLETE_CACHE_DIR}/${CACHE_NAME}"
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
local TMP_FILE=$(mktemp "$_KAC_CACHE_TMP_DIR/$CACHE_NAME.XXXX")
|
local TMP_FILE="$(mktemp "${_KAC_CACHE_TMP_DIR}/${CACHE_NAME}.XXXX")"
|
||||||
shift 1
|
shift 1
|
||||||
# discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated
|
# discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated
|
||||||
if ! "$@" > "$TMP_FILE" 2> /dev/null; then
|
if ! "$@" > "$TMP_FILE" 2> /dev/null
|
||||||
|
then
|
||||||
[[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1
|
[[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1
|
||||||
else
|
else
|
||||||
mv -f "$TMP_FILE" "$CACHE_PATH"
|
mv -f "$TMP_FILE" "$CACHE_PATH"
|
||||||
|
|
@ -54,12 +61,22 @@ _KAC_regen_cache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# cached files can't have spaces in their names
|
# cached files can't have spaces in their names
|
||||||
_KAC_get_cache_name_from_command() {
|
function _KAC_get_cache_name_from_command()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
echo "${@// /_SPACE_}"
|
echo "${@// /_SPACE_}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# the reverse operation from the function above
|
# the reverse operation from the function above
|
||||||
_KAC_get_command_from_cache_name() {
|
function _KAC_get_command_from_cache_name()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
echo "${@//_SPACE_/ }"
|
echo "${@//_SPACE_/ }"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,35 +85,48 @@ _KAC_get_command_from_cache_name() {
|
||||||
# in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable
|
# in either case, it regenerates the cache, and sets the _KAC_CACHE_PATH env variable
|
||||||
# for obvious reason, do NOT call that in a sub-shell (in particular, no piping)
|
# for obvious reason, do NOT call that in a sub-shell (in particular, no piping)
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
_KAC_get_and_regen_cache() {
|
function _KAC_get_and_regen_cache()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
# the cache name can't have space in it
|
# the cache name can't have space in it
|
||||||
local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@")
|
local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@")
|
||||||
local REGEN_CMD="_KAC_regen_cache $CACHE_NAME $*"
|
local REGEN_CMD="_KAC_regen_cache ${CACHE_NAME} $*"
|
||||||
_KAC_CACHE_PATH="$_KNIFE_AUTOCOMPLETE_CACHE_DIR/$CACHE_NAME"
|
_KAC_CACHE_PATH="${_KNIFE_AUTOCOMPLETE_CACHE_DIR}/${CACHE_NAME}"
|
||||||
# no need to wait for the regen if the file already exists
|
# no need to wait for the regen if the file already exists
|
||||||
if [[ -f "$_KAC_CACHE_PATH" ]]; then
|
if [[ -f "${_KAC_CACHE_PATH}" ]]
|
||||||
($REGEN_CMD &)
|
then
|
||||||
|
(${REGEN_CMD} &)
|
||||||
else
|
else
|
||||||
$REGEN_CMD
|
${REGEN_CMD}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# performs two things: first, deletes all obsolete temp files
|
# performs two things: first, deletes all obsolete temp files
|
||||||
# then refreshes stale caches that haven't been called in a long time
|
# then refreshes stale caches that haven't been called in a long time
|
||||||
_KAC_clean_cache() {
|
function _KAC_clean_cache()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local FILE CMD
|
local FILE CMD
|
||||||
# delete all obsolete temp files, could be lingering there for any kind of crash in the caching process
|
# delete all obsolete temp files, could be lingering there for any kind of crash in the caching process
|
||||||
for FILE in "$_KAC_CACHE_TMP_DIR"/*; do
|
for FILE in "$_KAC_CACHE_TMP_DIR"/*
|
||||||
_KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" || rm -f "$FILE"
|
do
|
||||||
|
_KAC_is_file_newer_than "${FILE}" "${_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE}" || rm -f "${FILE}"
|
||||||
done
|
done
|
||||||
# refresh really stale caches
|
# refresh really stale caches
|
||||||
find "$_KNIFE_AUTOCOMPLETE_CACHE_DIR" -maxdepth 1 -type f -not -name '.*' \
|
find "${_KNIFE_AUTOCOMPLETE_CACHE_DIR}" -maxdepth 1 -type f -not -name '.*' \
|
||||||
| while read -r FILE; do
|
| while read -r FILE
|
||||||
_KAC_is_file_newer_than "$FILE" "$_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE" && continue
|
do
|
||||||
|
_KAC_is_file_newer_than "${FILE}" "${_KNIFE_AUTOCOMPLETE_MAX_CACHE_AGE}" && continue
|
||||||
# first let's get the original command
|
# first let's get the original command
|
||||||
CMD=$(_KAC_get_command_from_cache_name "$(basename "$FILE")")
|
CMD=$(_KAC_get_command_from_cache_name "$(basename "$FILE")")
|
||||||
# then regen the cache
|
# then regen the cache
|
||||||
_KAC_get_and_regen_cache "$CMD" > /dev/null
|
_KAC_get_and_regen_cache "${CMD}" > /dev/null
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,26 +139,37 @@ _KAC_clean_cache() {
|
||||||
#####################################
|
#####################################
|
||||||
|
|
||||||
# returns all the possible knife sub-commands
|
# returns all the possible knife sub-commands
|
||||||
_KAC_knife_commands() {
|
function _KAC_knife_commands()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g'
|
knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
# rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND
|
# rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND
|
||||||
# additionnally, returns 1 iff the current base command is not complete, 0 otherwise
|
# additionnally, returns 1 iff the current base command is not complete, 0 otherwise
|
||||||
# also sets $_KAC_CURRENT_COMMAND_NB_WORDS if the base command is complete
|
# also sets $_KAC_CURRENT_COMMAND_NB_WORDS if the base command is complete
|
||||||
_KAC_get_current_base_command() {
|
function _KAC_get_current_base_command()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local PREVIOUS="knife"
|
local PREVIOUS="knife"
|
||||||
local I=1
|
local I=1
|
||||||
local CURRENT
|
local CURRENT
|
||||||
while [[ "${I}" -le "${COMP_CWORD}" ]]; do
|
while [[ "${I}" -le "${COMP_CWORD}" ]]
|
||||||
|
do
|
||||||
# command words are all lower-case
|
# command words are all lower-case
|
||||||
echo "${COMP_WORDS[$I]}" | grep -E "^[a-z]+$" > /dev/null || break
|
echo "${COMP_WORDS[$I]}" | grep -E "^[a-z]+$" > /dev/null || break
|
||||||
CURRENT="$PREVIOUS ${COMP_WORDS[$I]}"
|
CURRENT="${PREVIOUS} ${COMP_WORDS[$I]}"
|
||||||
grep -E "^$CURRENT" "$_KAC_CACHE_PATH" > /dev/null || break
|
grep -E "^${CURRENT}" "${_KAC_CACHE_PATH}" > /dev/null || break
|
||||||
PREVIOUS=$CURRENT
|
PREVIOUS="${CURRENT}"
|
||||||
I=$((I + 1))
|
I=$((I + 1))
|
||||||
done
|
done
|
||||||
_KAC_CURRENT_COMMAND=$PREVIOUS
|
_KAC_CURRENT_COMMAND="${PREVIOUS}"
|
||||||
[[ "${I}" -le "${COMP_CWORD}" ]] && _KAC_CURRENT_COMMAND_NB_WORDS="${I}"
|
[[ "${I}" -le "${COMP_CWORD}" ]] && _KAC_CURRENT_COMMAND_NB_WORDS="${I}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,21 +177,32 @@ _KAC_get_current_base_command() {
|
||||||
# (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...)
|
# (i.e. handles "plural" arguments such as knife cookbook upload cookbook1 cookbook2 and so on...)
|
||||||
# assumes the current base command is complete
|
# assumes the current base command is complete
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
_KAC_get_current_arg_position() {
|
function _KAC_get_current_arg_position()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local CURRENT_ARG_POS=$((_KAC_CURRENT_COMMAND_NB_WORDS + 1))
|
local CURRENT_ARG_POS=$((_KAC_CURRENT_COMMAND_NB_WORDS + 1))
|
||||||
local COMPLETE_COMMAND=$(grep -E "^$_KAC_CURRENT_COMMAND" "$_KAC_CACHE_PATH")
|
local COMPLETE_COMMAND=$(grep -E "^${_KAC_CURRENT_COMMAND}" "${_KAC_CACHE_PATH}")
|
||||||
local CURRENT_ARG
|
local CURRENT_ARG
|
||||||
while [ "$CURRENT_ARG_POS" -le "$COMP_CWORD" ]; do
|
while [ "${CURRENT_ARG_POS}" -le "${COMP_CWORD}" ]
|
||||||
CURRENT_ARG=$(echo "$COMPLETE_COMMAND" | cut -d ' ' -f "$CURRENT_ARG_POS")
|
do
|
||||||
|
CURRENT_ARG=$(echo "${COMPLETE_COMMAND}" | cut -d ' ' -f "${CURRENT_ARG_POS}")
|
||||||
# we break if the current arg is a "plural" arg
|
# we break if the current arg is a "plural" arg
|
||||||
echo "$CURRENT_ARG" | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break
|
echo "${CURRENT_ARG}" | grep -E "^\\[[^]]+(\\.\\.\\.\\]|$)" > /dev/null && break
|
||||||
CURRENT_ARG_POS=$((CURRENT_ARG_POS + 1))
|
CURRENT_ARG_POS=$((CURRENT_ARG_POS + 1))
|
||||||
done
|
done
|
||||||
echo "$CURRENT_ARG_POS"
|
echo "${CURRENT_ARG_POS}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# the actual auto-complete function
|
# the actual auto-complete function
|
||||||
_knife() {
|
function _knife()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
_KAC_get_and_regen_cache _KAC_knife_commands
|
_KAC_get_and_regen_cache _KAC_knife_commands
|
||||||
local RAW_LIST ITEM REGEN_CMD ARG_POSITION
|
local RAW_LIST ITEM REGEN_CMD ARG_POSITION
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
|
@ -165,10 +217,11 @@ _knife() {
|
||||||
# current base command - that might limit my script in some situation, but that way I'm sure it caches only
|
# current base command - that might limit my script in some situation, but that way I'm sure it caches only
|
||||||
# not-sensitive stuff (a generic approach could be pretty bad e.g. with the knife-rackspace plugin)
|
# not-sensitive stuff (a generic approach could be pretty bad e.g. with the knife-rackspace plugin)
|
||||||
LIST=""
|
LIST=""
|
||||||
for ITEM in $RAW_LIST; do
|
for ITEM in $RAW_LIST
|
||||||
|
do
|
||||||
# always relevant if only lower-case chars : continuation of the base command
|
# always relevant if only lower-case chars : continuation of the base command
|
||||||
echo "$ITEM" | grep -E "^[a-z]+$" > /dev/null && LIST="$LIST $ITEM" && continue
|
echo "${ITEM}" | grep -E "^[a-z]+$" > /dev/null && LIST="${LIST} ${ITEM}" && continue
|
||||||
case "$ITEM" in
|
case "${ITEM}" in
|
||||||
*COOKBOOK*)
|
*COOKBOOK*)
|
||||||
# special case for cookbooks : from site or local
|
# special case for cookbooks : from site or local
|
||||||
[[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list"
|
[[ ${COMP_WORDS[2]} == 'site' ]] && REGEN_CMD="knife cookbook site list" || REGEN_CMD="knife cookbook list"
|
||||||
|
|
@ -179,11 +232,11 @@ _knife() {
|
||||||
*ITEM*)
|
*ITEM*)
|
||||||
# data bag item : another special case
|
# data bag item : another special case
|
||||||
local DATA_BAG_NAME=${COMP_WORDS[$((COMP_CWORD - 1))]}
|
local DATA_BAG_NAME=${COMP_WORDS[$((COMP_CWORD - 1))]}
|
||||||
REGEN_CMD="knife data bag show $DATA_BAG_NAME"
|
REGEN_CMD="knife data bag show ${DATA_BAG_NAME}"
|
||||||
;;
|
;;
|
||||||
*INDEX*)
|
*INDEX*)
|
||||||
# see doc @ http://docs.opscode.com/knife_search.html
|
# see doc @ http://docs.opscode.com/knife_search.html
|
||||||
LIST="$LIST client environment node role"
|
LIST="${LIST} client environment node role"
|
||||||
REGEN_CMD="knife data bag list"
|
REGEN_CMD="knife data bag list"
|
||||||
;;
|
;;
|
||||||
*BAG*) REGEN_CMD="knife data bag list" ;;
|
*BAG*) REGEN_CMD="knife data bag list" ;;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
if _command_exists kontena; then
|
if _command_exists kontena
|
||||||
|
then
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "$(kontena whoami --bash-completion-path)"
|
source "$(kontena whoami --bash-completion-path)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "kubectl (Kubernetes CLI) completion"
|
about-completion "kubectl (Kubernetes CLI) completion"
|
||||||
|
|
||||||
if _binary_exists kubectl; then
|
if _binary_exists kubectl
|
||||||
|
then
|
||||||
eval "$(kubectl completion bash)"
|
eval "$(kubectl completion bash)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,19 @@
|
||||||
|
|
||||||
_command_exists laravel || return
|
_command_exists laravel || return
|
||||||
|
|
||||||
function __laravel_completion() {
|
function __laravel_completion()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local OPTS=('-h' '--help' '-q' '--quiet' '--ansi' '--no-ansi' '-n' '--no-interaction' '-v' '-vv' '-vvv' '--verbose' 'help' 'list' 'new')
|
local OPTS=('-h' '--help' '-q' '--quiet' '--ansi' '--no-ansi' '-n' '--no-interaction' '-v' '-vv' '-vvv' '--verbose' 'help' 'list' 'new')
|
||||||
local _opt_
|
local _opt_
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
for _opt_ in "${OPTS[@]}"; do
|
for _opt_ in "${OPTS[@]}"
|
||||||
if [[ "$_opt_" == "$2"* ]]; then
|
do
|
||||||
|
if [[ "${_opt_}" == "${2}"* ]]
|
||||||
|
then
|
||||||
COMPREPLY+=("$_opt_")
|
COMPREPLY+=("$_opt_")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,12 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "lerna(javascript project manager tool) completion"
|
about-completion "lerna(javascript project manager tool) completion"
|
||||||
|
|
||||||
function __lerna_completion() {
|
function __lerna_completion()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local cur compls
|
local cur compls
|
||||||
|
|
||||||
# The currently-being-completed word.
|
# The currently-being-completed word.
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
# Bash completion for Makefile
|
# Bash completion for Makefile
|
||||||
# Loosely adapted from http://stackoverflow.com/a/38415982/1472048
|
# Loosely adapted from http://stackoverflow.com/a/38415982/1472048
|
||||||
|
|
||||||
_makecomplete() {
|
function _makecomplete()
|
||||||
|
{
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
|
|
||||||
# https://www.gnu.org/software/make/manual/html_node/Makefile-Names.html
|
# https://www.gnu.org/software/make/manual/html_node/Makefile-Names.html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Bash Maven completion
|
# Bash Maven completion
|
||||||
|
|
||||||
_mvn()
|
function _mvn()
|
||||||
{
|
{
|
||||||
local cmds cur colonprefixes
|
local cmds cur colonprefixes
|
||||||
cmds="clean validate compile test package integration-test \
|
cmds="clean validate compile test package integration-test \
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# minikube (Local Kubernetes) completion
|
# minikube (Local Kubernetes) completion
|
||||||
|
|
||||||
if _command_exists minikube; then
|
if _command_exists minikube
|
||||||
|
then
|
||||||
eval "$(minikube completion bash)"
|
eval "$(minikube completion bash)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
if _command_exists ng; then
|
if _command_exists ng
|
||||||
|
then
|
||||||
# No longer supported, please see https://github.com/angular/angular-cli/issues/11043
|
# No longer supported, please see https://github.com/angular/angular-cli/issues/11043
|
||||||
# Fix courtesy of https://stackoverflow.com/questions/50194674/ng-completion-no-longer-exists
|
# Fix courtesy of https://stackoverflow.com/questions/50194674/ng-completion-no-longer-exists
|
||||||
# . <(ng completion --bash)
|
# . <(ng completion --bash)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
__ngrok_completion() {
|
function __ngrok_completion()
|
||||||
|
{
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
local prev=$(_get_pword)
|
local prev=$(_get_pword)
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
function __notify-send_completions() {
|
function __notify-send_completions()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
local curr=$(_get_cword)
|
local curr=$(_get_cword)
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "npm (Node Package Manager) completion"
|
about-completion "npm (Node Package Manager) completion"
|
||||||
|
|
||||||
if _command_exists npm; then
|
if _command_exists npm
|
||||||
|
then
|
||||||
eval "$(npm completion)"
|
eval "$(npm completion)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "packer completion"
|
about-completion "packer completion"
|
||||||
|
|
||||||
if _binary_exists packer; then
|
if _binary_exists packer
|
||||||
|
then
|
||||||
complete -C packer packer
|
complete -C packer packer
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,14 @@
|
||||||
# So that pip is in the system's path.
|
# So that pip is in the system's path.
|
||||||
_command_exists pip || return
|
_command_exists pip || return
|
||||||
|
|
||||||
function __bash_it_complete_pip() {
|
function __bash_it_complete_pip()
|
||||||
if _command_exists _pip_completion; then
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
if _command_exists _pip_completion
|
||||||
|
then
|
||||||
complete -o default -F _pip_completion pip
|
complete -o default -F _pip_completion pip
|
||||||
_pip_completion "$@"
|
_pip_completion "$@"
|
||||||
else
|
else
|
||||||
|
|
@ -17,4 +23,5 @@ function __bash_it_complete_pip() {
|
||||||
_pip_completion "$@"
|
_pip_completion "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -o default -F __bash_it_complete_pip pip
|
complete -o default -F __bash_it_complete_pip pip
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,14 @@
|
||||||
# So that pip3 is in the system's path.
|
# So that pip3 is in the system's path.
|
||||||
_command_exists pip3 || return
|
_command_exists pip3 || return
|
||||||
|
|
||||||
function __bash_it_complete_pip3() {
|
function __bash_it_complete_pip3()
|
||||||
if _command_exists _pip_completion; then
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
if _command_exists _pip_completion
|
||||||
|
then
|
||||||
complete -o default -F _pip_completion pip3
|
complete -o default -F _pip_completion pip3
|
||||||
_pip_completion "$@"
|
_pip_completion "$@"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
if _command_exists pipenv; then
|
if _command_exists pipenv
|
||||||
|
then
|
||||||
eval "$(_PIPENV_COMPLETE=bash_source pipenv)"
|
eval "$(_PIPENV_COMPLETE=bash_source pipenv)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# pipx completion
|
# pipx completion
|
||||||
|
|
||||||
if _command_exists register-python-argcomplete && _command_exists pipx; then
|
if _command_exists register-python-argcomplete && _command_exists pipx
|
||||||
|
then
|
||||||
eval "$(register-python-argcomplete pipx)"
|
eval "$(register-python-argcomplete pipx)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,17 @@ _is_function _init_completion ||
|
||||||
_is_function _rl_enabled ||
|
_is_function _rl_enabled ||
|
||||||
_log_error '_rl_enabled not found. Ensure bash-completion 2.0 or newer is installed and configured properly.'
|
_log_error '_rl_enabled not found. Ensure bash-completion 2.0 or newer is installed and configured properly.'
|
||||||
|
|
||||||
_pj() {
|
function _pj()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
_is_function _init_completion || return
|
_is_function _init_completion || return
|
||||||
_is_function _rl_enabled || return
|
_is_function _rl_enabled || return
|
||||||
[ -n "$BASH_IT_PROJECT_PATHS" ] || return
|
[ -n "$BASH_IT_PROJECT_PATHS" ] || return
|
||||||
shift
|
shift
|
||||||
[ "$1" == "open" ] && shift
|
[ "${1}" == "open" ] && shift
|
||||||
|
|
||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
_init_completion || return
|
_init_completion || return
|
||||||
|
|
@ -21,20 +26,25 @@ _pj() {
|
||||||
local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
|
local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
|
||||||
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
|
local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
|
||||||
|
|
||||||
for i in ${BASH_IT_PROJECT_PATHS//:/$'\n'}; do
|
for i in ${BASH_IT_PROJECT_PATHS//:/$'\n'}
|
||||||
|
do
|
||||||
# create an array of matched subdirs
|
# create an array of matched subdirs
|
||||||
k="${#COMPREPLY[@]}"
|
k="${#COMPREPLY[@]}"
|
||||||
for j in $( compgen -d $i/$cur ); do
|
for j in $( compgen -d $i/$cur )
|
||||||
if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
|
do
|
||||||
|
if [[ ( ${mark_symdirs} && -h $j || ${mark_dirs} && ! -h $j ) && ! -d ${j#$i/} ]]
|
||||||
|
then
|
||||||
j+="/"
|
j+="/"
|
||||||
fi
|
fi
|
||||||
COMPREPLY[k++]=${j#$i/}
|
COMPREPLY[k++]=${j#$i/}
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
|
if [[ ${#COMPREPLY[@]} -eq 1 ]]
|
||||||
|
then
|
||||||
i=${COMPREPLY[0]}
|
i=${COMPREPLY[0]}
|
||||||
if [[ "$i" == "$cur" && $i != "*/" ]]; then
|
if [[ "$i" == "$cur" && $i != "*/" ]]
|
||||||
|
then
|
||||||
COMPREPLY[0]="${i}/"
|
COMPREPLY[0]="${i}/"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,12 @@
|
||||||
|
|
||||||
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
|
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
|
||||||
|
|
||||||
_rakecomplete() {
|
function _rakecomplete() {
|
||||||
if [ -f Rakefile ]; then
|
if [ -f Rakefile ]
|
||||||
|
then
|
||||||
recent=`ls -t .rake_tasks~ Rakefile **/*.rake 2> /dev/null | head -n 1`
|
recent=`ls -t .rake_tasks~ Rakefile **/*.rake 2> /dev/null | head -n 1`
|
||||||
if [[ $recent != '.rake_tasks~' ]]; then
|
if [[ $recent != '.rake_tasks~' ]]
|
||||||
|
then
|
||||||
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
|
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
|
||||||
fi
|
fi
|
||||||
COMPREPLY=($(compgen -W "`cat .rake_tasks~`" -- ${COMP_WORDS[COMP_CWORD]}))
|
COMPREPLY=($(compgen -W "`cat .rake_tasks~`" -- ${COMP_WORDS[COMP_CWORD]}))
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
# rustup (Rust toolchain installer) completion
|
# rustup (Rust toolchain installer) completion
|
||||||
|
|
||||||
if _binary_exists rustup; then
|
if _binary_exists rustup
|
||||||
|
then
|
||||||
eval "$(rustup completions bash)"
|
eval "$(rustup completions bash)"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,24 @@
|
||||||
# TODO: is it ok to use '--timeout 2' ?
|
# TODO: is it ok to use '--timeout 2' ?
|
||||||
|
|
||||||
|
|
||||||
_salt_get_grains(){
|
function _salt_get_grains()
|
||||||
if [ "$1" = 'local' ] ; then
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
|
if [ "${1}" = 'local' ]
|
||||||
|
then
|
||||||
salt-call --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
|
salt-call --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
|
||||||
else
|
else
|
||||||
salt '*' --timeout 2 --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
|
salt '*' --timeout 2 --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_salt_get_grain_values(){
|
function _salt_get_grain_values()
|
||||||
if [ "$1" = 'local' ] ; then
|
{
|
||||||
|
if [ "${1}" = 'local' ]
|
||||||
|
then
|
||||||
salt-call --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
|
salt-call --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
|
||||||
else
|
else
|
||||||
salt '*' --timeout 2 --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
|
salt '*' --timeout 2 --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
|
||||||
|
|
@ -44,15 +52,22 @@ _salt_get_grain_values(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_salt(){
|
function _salt()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local cur prev opts _salt_grains _salt_coms pprev ppprev
|
local cur prev opts _salt_grains _salt_coms pprev ppprev
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
if [ ${COMP_CWORD} -gt 2 ]; then
|
if [ ${COMP_CWORD} -gt 2 ]
|
||||||
|
then
|
||||||
pprev="${COMP_WORDS[COMP_CWORD-2]}"
|
pprev="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
fi
|
fi
|
||||||
if [ ${COMP_CWORD} -gt 3 ]; then
|
if [ ${COMP_CWORD} -gt 3 ]
|
||||||
|
then
|
||||||
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
|
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -64,7 +79,8 @@ _salt(){
|
||||||
--ipcidr --out=pprint --out=yaml --out=overstatestage --out=json \
|
--ipcidr --out=pprint --out=yaml --out=overstatestage --out=json \
|
||||||
--out=raw --out=highstate --out=key --out=txt --no-color --out-indent= "
|
--out=raw --out=highstate --out=key --out=txt --no-color --out-indent= "
|
||||||
|
|
||||||
if [[ "${cur}" == -* ]] ; then
|
if [[ "${cur}" == -* ]]
|
||||||
|
then
|
||||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -72,7 +88,8 @@ _salt(){
|
||||||
# 2 special cases for filling up grain values
|
# 2 special cases for filling up grain values
|
||||||
case "${pprev}" in
|
case "${pprev}" in
|
||||||
-G|--grain|--grain-pcre)
|
-G|--grain|--grain-pcre)
|
||||||
if [ "${cur}" = ":" ]; then
|
if [ "${cur}" = ":" ]
|
||||||
|
then
|
||||||
COMPREPLY=($(compgen -W "`_salt_get_grain_values ${prev}`" ))
|
COMPREPLY=($(compgen -W "`_salt_get_grain_values ${prev}`" ))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -80,17 +97,20 @@ _salt(){
|
||||||
esac
|
esac
|
||||||
case "${ppprev}" in
|
case "${ppprev}" in
|
||||||
-G|--grain|--grain-pcre)
|
-G|--grain|--grain-pcre)
|
||||||
if [ "${prev}" = ":" ]; then
|
if [ "${prev}" = ":" ]
|
||||||
|
then
|
||||||
COMPREPLY=( $(compgen -W "`_salt_get_grain_values ${pprev}`" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "`_salt_get_grain_values ${pprev}`" -- ${cur}) )
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
|
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]
|
||||||
|
then
|
||||||
cur=""
|
cur=""
|
||||||
fi
|
fi
|
||||||
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
|
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]
|
||||||
|
then
|
||||||
prev="${pprev}"
|
prev="${pprev}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -141,7 +161,12 @@ _salt(){
|
||||||
complete -F _salt salt
|
complete -F _salt salt
|
||||||
|
|
||||||
|
|
||||||
_saltkey(){
|
function _saltkey()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local cur prev opts prev pprev
|
local cur prev opts prev pprev
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
|
@ -153,21 +178,26 @@ _saltkey(){
|
||||||
-d --delete= -D --delete-all -f --finger= -F --finger-all \
|
-d --delete= -D --delete-all -f --finger= -F --finger-all \
|
||||||
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
|
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
|
||||||
--out=highstate --out=key --out=txt --no-color --out-indent= "
|
--out=highstate --out=key --out=txt --no-color --out-indent= "
|
||||||
if [ ${COMP_CWORD} -gt 2 ]; then
|
if [ ${COMP_CWORD} -gt 2 ]
|
||||||
|
then
|
||||||
pprev="${COMP_WORDS[COMP_CWORD-2]}"
|
pprev="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
fi
|
fi
|
||||||
if [ ${COMP_CWORD} -gt 3 ]; then
|
if [ ${COMP_CWORD} -gt 3 ]
|
||||||
|
then
|
||||||
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
|
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
|
||||||
fi
|
fi
|
||||||
if [[ "${cur}" == -* ]] ; then
|
if [[ "${cur}" == -* ]]
|
||||||
|
then
|
||||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
|
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]
|
||||||
|
then
|
||||||
cur=""
|
cur=""
|
||||||
fi
|
fi
|
||||||
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
|
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]
|
||||||
|
then
|
||||||
prev="${pprev}"
|
prev="${pprev}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -217,7 +247,12 @@ _saltkey(){
|
||||||
|
|
||||||
complete -F _saltkey salt-key
|
complete -F _saltkey salt-key
|
||||||
|
|
||||||
_saltcall(){
|
function _saltcall()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local cur prev opts _salt_coms pprev ppprev
|
local cur prev opts _salt_coms pprev ppprev
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
|
@ -226,21 +261,26 @@ _saltcall(){
|
||||||
-m --module-dirs= -g --grains --return= --local -c --config-dir= -l --log-level= \
|
-m --module-dirs= -g --grains --return= --local -c --config-dir= -l --log-level= \
|
||||||
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
|
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
|
||||||
--out=highstate --out=key --out=txt --no-color --out-indent= "
|
--out=highstate --out=key --out=txt --no-color --out-indent= "
|
||||||
if [ ${COMP_CWORD} -gt 2 ]; then
|
if [ ${COMP_CWORD} -gt 2 ]
|
||||||
|
then
|
||||||
pprev="${COMP_WORDS[COMP_CWORD-2]}"
|
pprev="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
fi
|
fi
|
||||||
if [ ${COMP_CWORD} -gt 3 ]; then
|
if [ ${COMP_CWORD} -gt 3 ]
|
||||||
|
then
|
||||||
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
|
ppprev="${COMP_WORDS[COMP_CWORD-3]}"
|
||||||
fi
|
fi
|
||||||
if [[ "${cur}" == -* ]] ; then
|
if [[ "${cur}" == -* ]]
|
||||||
|
then
|
||||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${cur}" = "=" ] && [[ ${prev} == --* ]]; then
|
if [ "${cur}" = "=" ] && [[ ${prev} == --* ]]
|
||||||
|
then
|
||||||
cur=""
|
cur=""
|
||||||
fi
|
fi
|
||||||
if [ "${prev}" = "=" ] && [[ ${pprev} == --* ]]; then
|
if [ "${prev}" = "=" ] && [[ ${pprev} == --* ]]
|
||||||
|
then
|
||||||
prev="${pprev}"
|
prev="${pprev}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -270,7 +310,12 @@ _saltcall(){
|
||||||
complete -F _saltcall salt-call
|
complete -F _saltcall salt-call
|
||||||
|
|
||||||
|
|
||||||
_saltcp(){
|
function _saltcp()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local cur prev opts target prefpart postpart helper filt pprev ppprev
|
local cur prev opts target prefpart postpart helper filt pprev ppprev
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
|
@ -281,15 +326,18 @@ _saltcp(){
|
||||||
-R --range -C --compound -I --pillar \
|
-R --range -C --compound -I --pillar \
|
||||||
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
|
--out=pprint --out=yaml --out=overstatestage --out=json --out=raw \
|
||||||
--out=highstate --out=key --out=txt --no-color --out-indent= "
|
--out=highstate --out=key --out=txt --no-color --out-indent= "
|
||||||
if [[ "${cur}" == -* ]] ; then
|
if [[ "${cur}" == -* ]]
|
||||||
|
then
|
||||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]; then
|
if [ "${cur}" = "=" ] && [[ "${prev}" == --* ]]
|
||||||
|
then
|
||||||
cur=""
|
cur=""
|
||||||
fi
|
fi
|
||||||
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]; then
|
if [ "${prev}" = "=" ] && [[ "${pprev}" == --* ]]
|
||||||
|
then
|
||||||
prev=${pprev}
|
prev=${pprev}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,11 @@ function _sdkman_complete() {
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
|
|
||||||
if [ "$COMP_CWORD" -eq 1 ]; then
|
if [ "$COMP_CWORD" -eq 1 ]
|
||||||
|
then
|
||||||
mapfile -t COMPREPLY < <(compgen -W "install uninstall rm list ls use default home env current upgrade ug version broadcast help offline selfupdate update flush" -- "${COMP_WORDS[COMP_CWORD]}")
|
mapfile -t COMPREPLY < <(compgen -W "install uninstall rm list ls use default home env current upgrade ug version broadcast help offline selfupdate update flush" -- "${COMP_WORDS[COMP_CWORD]}")
|
||||||
elif [ "$COMP_CWORD" -eq 2 ]; then
|
elif [ "$COMP_CWORD" -eq 2 ]
|
||||||
|
then
|
||||||
case "${COMP_WORDS[COMP_CWORD - 1]}" in
|
case "${COMP_WORDS[COMP_CWORD - 1]}" in
|
||||||
"install" | "i" | "uninstall" | "rm" | "list" | "ls" | "use" | "u" | "default" | "d" | "home" | "h" | "current" | "c" | "upgrade" | "ug")
|
"install" | "i" | "uninstall" | "rm" | "list" | "ls" | "use" | "u" | "default" | "d" | "home" | "h" | "current" | "c" | "upgrade" | "ug")
|
||||||
CANDIDATES="${SDKMAN_CANDIDATES_CSV//,/${IFS:0:1}}"
|
CANDIDATES="${SDKMAN_CANDIDATES_CSV//,/${IFS:0:1}}"
|
||||||
|
|
@ -30,7 +32,8 @@ function _sdkman_complete() {
|
||||||
*) ;;
|
*) ;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
elif [ "$COMP_CWORD" -eq 3 ]; then
|
elif [ "$COMP_CWORD" -eq 3 ]
|
||||||
|
then
|
||||||
case "${COMP_WORDS[COMP_CWORD - 2]}" in
|
case "${COMP_WORDS[COMP_CWORD - 2]}" in
|
||||||
"uninstall" | "rm" | "use" | "u" | "default" | "d" | "home" | "h")
|
"uninstall" | "rm" | "use" | "u" | "default" | "d" | "home" | "h")
|
||||||
_sdkman_candidate_local_versions "${COMP_WORDS[COMP_CWORD - 1]}"
|
_sdkman_candidate_local_versions "${COMP_WORDS[COMP_CWORD - 1]}"
|
||||||
|
|
@ -50,20 +53,22 @@ function _sdkman_complete() {
|
||||||
|
|
||||||
function _sdkman_candidate_local_versions() {
|
function _sdkman_candidate_local_versions() {
|
||||||
|
|
||||||
CANDIDATE_VERSIONS=$(__sdkman_cleanup_local_versions "$1")
|
CANDIDATE_VERSIONS=$(__sdkman_cleanup_local_versions "${1}")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _sdkman_candidate_all_versions() {
|
function _sdkman_candidate_all_versions() {
|
||||||
|
|
||||||
candidate="$1"
|
candidate="${1}"
|
||||||
CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions "$candidate")
|
CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions "$candidate")
|
||||||
if [[ "${SDKMAN_OFFLINE_MODE:-false}" == "true" ]]; then
|
if [[ "${SDKMAN_OFFLINE_MODE:-false}" == "true" ]]
|
||||||
|
then
|
||||||
CANDIDATE_VERSIONS=$CANDIDATE_LOCAL_VERSIONS
|
CANDIDATE_VERSIONS=$CANDIDATE_LOCAL_VERSIONS
|
||||||
else
|
else
|
||||||
# sdkman has a specific output format for Java candidate since
|
# sdkman has a specific output format for Java candidate since
|
||||||
# there are multiple vendors and builds.
|
# there are multiple vendors and builds.
|
||||||
if [ "$candidate" = "java" ]; then
|
if [ "$candidate" = "java" ]
|
||||||
|
then
|
||||||
CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$candidate" | grep " " | grep "\." | cut -c 62-)"
|
CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$candidate" | grep " " | grep "\." | cut -c 62-)"
|
||||||
else
|
else
|
||||||
CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$candidate" | grep " " | grep "\." | cut -c 6-)"
|
CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$candidate" | grep " " | grep "\." | cut -c 6-)"
|
||||||
|
|
@ -79,7 +84,7 @@ function _sdkman_candidate_all_versions() {
|
||||||
|
|
||||||
function __sdkman_cleanup_local_versions() {
|
function __sdkman_cleanup_local_versions() {
|
||||||
|
|
||||||
__sdkman_build_version_csv "$1" | tr ',' ' '
|
__sdkman_build_version_csv "${1}" | tr ',' ' '
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,8 @@ then
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == * ]]; then
|
if [[ "$cur" == * ]]
|
||||||
|
then
|
||||||
COMPREPLY=( $( compgen -W '-h --help -hh --version -v -d -u --url -l -x -m -r -g -c --method \
|
COMPREPLY=( $( compgen -W '-h --help -hh --version -v -d -u --url -l -x -m -r -g -c --method \
|
||||||
--data --param-del --cookie --cookie-del --load-cookies \
|
--data --param-del --cookie --cookie-del --load-cookies \
|
||||||
--drop-set-cookie --user-agent --random-agent --host --referer \
|
--drop-set-cookie --user-agent --random-agent --host --referer \
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
|
||||||
|
|
||||||
_sshcomplete() {
|
_sshcomplete() {
|
||||||
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
|
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
|
||||||
if [[ ${CURRENT_PROMPT} == *@* ]] ; then
|
if [[ ${CURRENT_PROMPT} == *@* ]]
|
||||||
|
then
|
||||||
local OPTIONS="-P ${CURRENT_PROMPT/@*/}@ -- ${CURRENT_PROMPT/*@/}"
|
local OPTIONS="-P ${CURRENT_PROMPT/@*/}@ -- ${CURRENT_PROMPT/*@/}"
|
||||||
else
|
else
|
||||||
local OPTIONS=" -- ${CURRENT_PROMPT}"
|
local OPTIONS=" -- ${CURRENT_PROMPT}"
|
||||||
|
|
@ -17,20 +18,24 @@ _sshcomplete() {
|
||||||
awk '{for (i=2; i<=NF; i++) print $i}' |
|
awk '{for (i=2; i<=NF; i++) print $i}' |
|
||||||
sed -Ee "s|^([^/~])|$HOME/.ssh/\1|" -e "s|^~/|$HOME/|")
|
sed -Ee "s|^([^/~])|$HOME/.ssh/\1|" -e "s|^~/|$HOME/|")
|
||||||
do
|
do
|
||||||
if [ -r "$fl" ]; then
|
if [ -r "$fl" ]
|
||||||
|
then
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$(grep -i ^Host "$fl" |grep -v '[*!]' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$(grep -i ^Host "$fl" |grep -v '[*!]' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# parse all hosts found in .ssh/known_hosts
|
# parse all hosts found in .ssh/known_hosts
|
||||||
if [ -r "$HOME/.ssh/known_hosts" ]; then
|
if [ -r "$HOME/.ssh/known_hosts" ]
|
||||||
if grep -v -q -e '^ ssh-rsa' "$HOME/.ssh/known_hosts" ; then
|
then
|
||||||
|
if grep -v -q -e '^ ssh-rsa' "$HOME/.ssh/known_hosts"
|
||||||
|
then
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' "$HOME/.ssh/known_hosts" | grep -v ^\| | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" ${OPTIONS}) )
|
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' "$HOME/.ssh/known_hosts" | grep -v ^\| | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" ${OPTIONS}) )
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# parse hosts defined in /etc/hosts
|
# parse hosts defined in /etc/hosts
|
||||||
if [ -r /etc/hosts ]; then
|
if [ -r /etc/hosts ]
|
||||||
|
then
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( grep -v '^[[:space:]]*$' /etc/hosts | grep -v '^#' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( grep -v '^[[:space:]]*$' /etc/hosts | grep -v '^#' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,15 @@
|
||||||
_command_exists svn || return
|
_command_exists svn || return
|
||||||
|
|
||||||
# Don't handle completion if it's already managed
|
# Don't handle completion if it's already managed
|
||||||
if _completion_exists svn; then
|
if _completion_exists svn
|
||||||
|
then
|
||||||
_log_warning "completion already loaded - this usually means it is safe to stop using this completion"
|
_log_warning "completion already loaded - this usually means it is safe to stop using this completion"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_svn_bash_completion_xcrun_svn=
|
_svn_bash_completion_xcrun_svn=
|
||||||
if _command_exists xcrun; then
|
if _command_exists xcrun
|
||||||
|
then
|
||||||
_svn_bash_completion_xcrun_svn="$(xcrun --find svn)"
|
_svn_bash_completion_xcrun_svn="$(xcrun --find svn)"
|
||||||
fi
|
fi
|
||||||
_svn_bash_completion_paths=(
|
_svn_bash_completion_paths=(
|
||||||
|
|
@ -25,7 +27,8 @@ _svn_bash_completion_paths=(
|
||||||
# Load the first completion file found
|
# Load the first completion file found
|
||||||
_svn_bash_completion_found=false
|
_svn_bash_completion_found=false
|
||||||
for _comp_path in "${_svn_bash_completion_paths[@]}"; do
|
for _comp_path in "${_svn_bash_completion_paths[@]}"; do
|
||||||
if [[ -r "$_comp_path" ]]; then
|
if [[ -r "$_comp_path" ]]
|
||||||
|
then
|
||||||
_svn_bash_completion_found=true
|
_svn_bash_completion_found=true
|
||||||
# shellcheck disable=SC1090 # don't follow
|
# shellcheck disable=SC1090 # don't follow
|
||||||
source "$_comp_path"
|
source "$_comp_path"
|
||||||
|
|
@ -34,7 +37,8 @@ for _comp_path in "${_svn_bash_completion_paths[@]}"; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
if [[ "${_svn_bash_completion_found}" == false ]]; then
|
if [[ "${_svn_bash_completion_found}" == false ]]
|
||||||
|
then
|
||||||
_log_warning "no completion files found - please try enabling the 'system' completion instead."
|
_log_warning "no completion files found - please try enabling the 'system' completion instead."
|
||||||
fi
|
fi
|
||||||
unset "${!_svn_bash_completion@}"
|
unset "${!_svn_bash_completion@}"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
# BASH_IT_LOAD_PRIORITY: 325
|
# BASH_IT_LOAD_PRIORITY: 325
|
||||||
|
|
||||||
# Bash-completion is too large and complex to expect to handle unbound variables throughout the whole codebase.
|
# Bash-completion is too large and complex to expect to handle unbound variables throughout the whole codebase.
|
||||||
if shopt -qo nounset; then
|
if shopt -qo nounset
|
||||||
|
then
|
||||||
__bash_it_restore_nounset=true
|
__bash_it_restore_nounset=true
|
||||||
shopt -uo nounset
|
shopt -uo nounset
|
||||||
else
|
else
|
||||||
|
|
@ -15,14 +16,18 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC1090 disable=SC1091
|
# shellcheck disable=SC1090 disable=SC1091
|
||||||
if [[ -r "${BASH_COMPLETION:-}" ]]; then
|
if [[ -r "${BASH_COMPLETION:-}" ]]
|
||||||
|
then
|
||||||
source "${BASH_COMPLETION}"
|
source "${BASH_COMPLETION}"
|
||||||
elif [[ -r /etc/bash_completion ]]; then
|
elif [[ -r /etc/bash_completion ]]
|
||||||
|
then
|
||||||
source /etc/bash_completion
|
source /etc/bash_completion
|
||||||
# Some distribution makes use of a profile.d script to import completion.
|
# Some distribution makes use of a profile.d script to import completion.
|
||||||
elif [[ -r /etc/profile.d/bash_completion.sh ]]; then
|
elif [[ -r /etc/profile.d/bash_completion.sh ]]
|
||||||
|
then
|
||||||
source /etc/profile.d/bash_completion.sh
|
source /etc/profile.d/bash_completion.sh
|
||||||
elif _bash_it_homebrew_check; then
|
elif _bash_it_homebrew_check
|
||||||
|
then
|
||||||
: "${BASH_COMPLETION_COMPAT_DIR:=${BASH_IT_HOMEBREW_PREFIX}/etc/bash_completion.d}"
|
: "${BASH_COMPLETION_COMPAT_DIR:=${BASH_IT_HOMEBREW_PREFIX}/etc/bash_completion.d}"
|
||||||
case "${BASH_VERSION}" in
|
case "${BASH_VERSION}" in
|
||||||
1* | 2* | 3.0* | 3.1*)
|
1* | 2* | 3.0* | 3.1*)
|
||||||
|
|
@ -31,7 +36,8 @@ elif _bash_it_homebrew_check; then
|
||||||
3.2* | 4.0* | 4.1*)
|
3.2* | 4.0* | 4.1*)
|
||||||
# Import version 1.x of bash-completion, if installed.
|
# Import version 1.x of bash-completion, if installed.
|
||||||
BASH_COMPLETION="${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@1/etc/bash_completion"
|
BASH_COMPLETION="${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@1/etc/bash_completion"
|
||||||
if [[ -r "$BASH_COMPLETION" ]]; then
|
if [[ -r "$BASH_COMPLETION" ]]
|
||||||
|
then
|
||||||
source "$BASH_COMPLETION"
|
source "$BASH_COMPLETION"
|
||||||
else
|
else
|
||||||
unset BASH_COMPLETION
|
unset BASH_COMPLETION
|
||||||
|
|
@ -39,14 +45,16 @@ elif _bash_it_homebrew_check; then
|
||||||
;;
|
;;
|
||||||
4.2* | 5* | *)
|
4.2* | 5* | *)
|
||||||
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
|
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
|
||||||
if [[ -r "${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@2/etc/profile.d/bash_completion.sh" ]]; then
|
if [[ -r "${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@2/etc/profile.d/bash_completion.sh" ]]
|
||||||
|
then
|
||||||
source "${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@2/etc/profile.d/bash_completion.sh"
|
source "${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@2/etc/profile.d/bash_completion.sh"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${__bash_it_restore_nounset:-false} == "true" ]]; then
|
if [[ ${__bash_it_restore_nounset:-false} == "true" ]]
|
||||||
|
then
|
||||||
shopt -so nounset
|
shopt -so nounset
|
||||||
fi
|
fi
|
||||||
unset __bash_it_restore_nounset
|
unset __bash_it_restore_nounset
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
__kitchen_instance_list () {
|
function __kitchen_instance_list () {
|
||||||
# cache to .kitchen.list.yml
|
# cache to .kitchen.list.yml
|
||||||
if [[ .kitchen.yml -nt .kitchen.list.yml || .kitchen.local.yml -nt .kitchen.list.yml ]]; then
|
if [[ .kitchen.yml -nt .kitchen.list.yml || .kitchen.local.yml -nt .kitchen.list.yml ]]
|
||||||
|
then
|
||||||
# update list if config has updated
|
# update list if config has updated
|
||||||
kitchen list --bare > .kitchen.list.yml
|
kitchen list --bare > .kitchen.list.yml
|
||||||
fi
|
fi
|
||||||
cat .kitchen.list.yml
|
cat .kitchen.list.yml
|
||||||
}
|
}
|
||||||
|
|
||||||
__kitchen_options () {
|
function __kitchen_options () {
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,15 @@
|
||||||
# See: http://www.debian-administration.org/articles/317 for how to write more.
|
# See: http://www.debian-administration.org/articles/317 for how to write more.
|
||||||
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc
|
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc
|
||||||
|
|
||||||
_tmux_expand ()
|
function _tmux_expand ()
|
||||||
{
|
{
|
||||||
[ "$cur" != "${cur%\\}" ] && cur="$cur"'\';
|
[ "$cur" != "${cur%\\}" ] && cur="$cur"'\';
|
||||||
if [[ "$cur" == \~*/* ]]; then
|
if [[ "$cur" == \~*/* ]]
|
||||||
|
then
|
||||||
eval cur=$cur;
|
eval cur=$cur;
|
||||||
else
|
else
|
||||||
if [[ "$cur" == \~* ]]; then
|
if [[ "$cur" == \~* ]]
|
||||||
|
then
|
||||||
cur=${cur#\~};
|
cur=${cur#\~};
|
||||||
COMPREPLY=($( compgen -P '~' -u $cur ));
|
COMPREPLY=($( compgen -P '~' -u $cur ));
|
||||||
return ${#COMPREPLY[@]};
|
return ${#COMPREPLY[@]};
|
||||||
|
|
@ -18,12 +20,13 @@ _tmux_expand ()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_tmux_filedir ()
|
function _tmux_filedir ()
|
||||||
{
|
{
|
||||||
local IFS='
|
local IFS='
|
||||||
';
|
';
|
||||||
_tmux_expand || return 0;
|
_tmux_expand || return 0;
|
||||||
if [ "$1" = -d ]; then
|
if [ "${1}" = -d ]
|
||||||
|
then
|
||||||
COMPREPLY=(${COMPREPLY[@]} $( compgen -d -- $cur ));
|
COMPREPLY=(${COMPREPLY[@]} $( compgen -d -- $cur ));
|
||||||
return 0;
|
return 0;
|
||||||
fi;
|
fi;
|
||||||
|
|
@ -47,7 +50,8 @@ function _tmux_complete_window() {
|
||||||
local sessions
|
local sessions
|
||||||
|
|
||||||
sessions="$(tmux -q list-sessions 2>/dev/null | sed -re 's/([^:]+:).*$/\1/')"
|
sessions="$(tmux -q list-sessions 2>/dev/null | sed -re 's/([^:]+:).*$/\1/')"
|
||||||
if [[ -n "${session_name}" ]]; then
|
if [[ -n "${session_name}" ]]
|
||||||
|
then
|
||||||
sessions="${sessions}
|
sessions="${sessions}
|
||||||
$(tmux -q list-windows -t "${session_name}" 2>/dev/null | sed -re 's/^([^:]+):.*$/'"${session_name}"':\1/')"
|
$(tmux -q list-windows -t "${session_name}" 2>/dev/null | sed -re 's/^([^:]+):.*$/'"${session_name}"':\1/')"
|
||||||
fi
|
fi
|
||||||
|
|
@ -56,7 +60,7 @@ function _tmux_complete_window() {
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${sessions}" -- "${cur}") )
|
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${sessions}" -- "${cur}") )
|
||||||
}
|
}
|
||||||
|
|
||||||
_tmux() {
|
function _tmux() {
|
||||||
local cur prev
|
local cur prev
|
||||||
local i cmd cmd_index option option_index
|
local i cmd cmd_index option option_index
|
||||||
local opts=""
|
local opts=""
|
||||||
|
|
@ -64,20 +68,24 @@ _tmux() {
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
if [ ${prev} == -f ]; then
|
if [ ${prev} == -f ]
|
||||||
|
then
|
||||||
_tmux_filedir
|
_tmux_filedir
|
||||||
else
|
else
|
||||||
# Search for the command
|
# Search for the command
|
||||||
local skip_next=0
|
local skip_next=0
|
||||||
for ((i=1; $i<=$COMP_CWORD; i++)); do
|
for ((i=1; $i<=$COMP_CWORD; i++)); do
|
||||||
if [[ ${skip_next} -eq 1 ]]; then
|
if [[ ${skip_next} -eq 1 ]]
|
||||||
|
then
|
||||||
#echo "Skipping"
|
#echo "Skipping"
|
||||||
skip_next=0;
|
skip_next=0;
|
||||||
elif [[ ${COMP_WORDS[i]} != -* ]]; then
|
elif [[ ${COMP_WORDS[i]} != -* ]]
|
||||||
|
then
|
||||||
cmd="${COMP_WORDS[i]}"
|
cmd="${COMP_WORDS[i]}"
|
||||||
cmd_index=${i}
|
cmd_index=${i}
|
||||||
break
|
break
|
||||||
elif [[ ${COMP_WORDS[i]} == -f ]]; then
|
elif [[ ${COMP_WORDS[i]} == -f ]]
|
||||||
|
then
|
||||||
skip_next=1
|
skip_next=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -85,21 +93,26 @@ _tmux() {
|
||||||
# Search for the last option command
|
# Search for the last option command
|
||||||
skip_next=0
|
skip_next=0
|
||||||
for ((i=1; $i<=$COMP_CWORD; i++)); do
|
for ((i=1; $i<=$COMP_CWORD; i++)); do
|
||||||
if [[ ${skip_next} -eq 1 ]]; then
|
if [[ ${skip_next} -eq 1 ]]
|
||||||
|
then
|
||||||
#echo "Skipping"
|
#echo "Skipping"
|
||||||
skip_next=0;
|
skip_next=0;
|
||||||
elif [[ ${COMP_WORDS[i]} == -* ]]; then
|
elif [[ ${COMP_WORDS[i]} == -* ]]
|
||||||
|
then
|
||||||
option="${COMP_WORDS[i]}"
|
option="${COMP_WORDS[i]}"
|
||||||
option_index=${i}
|
option_index=${i}
|
||||||
if [[ ${COMP_WORDS[i]} == -- ]]; then
|
if [[ ${COMP_WORDS[i]} == -- ]]
|
||||||
|
then
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
elif [[ ${COMP_WORDS[i]} == -f ]]; then
|
elif [[ ${COMP_WORDS[i]} == -f ]]
|
||||||
|
then
|
||||||
skip_next=1
|
skip_next=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $COMP_CWORD -le $cmd_index ]]; then
|
if [[ $COMP_CWORD -le $cmd_index ]]
|
||||||
|
then
|
||||||
# The user has not specified a command yet
|
# The user has not specified a command yet
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$(tmux start-server \; list-commands | cut -d' ' -f1)" -- "${cur}") )
|
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$(tmux start-server \; list-commands | cut -d' ' -f1)" -- "${cur}") )
|
||||||
else
|
else
|
||||||
|
|
@ -129,7 +142,8 @@ _tmux() {
|
||||||
-t) _tmux_complete_session "${cur}" ;;
|
-t) _tmux_complete_session "${cur}" ;;
|
||||||
-[n|d|s]) options="-d -n -s -t --" ;;
|
-[n|d|s]) options="-d -n -s -t --" ;;
|
||||||
*)
|
*)
|
||||||
if [[ ${COMP_WORDS[option_index]} == -- ]]; then
|
if [[ ${COMP_WORDS[option_index]} == -- ]]
|
||||||
|
then
|
||||||
_command_offset ${option_index}
|
_command_offset ${option_index}
|
||||||
else
|
else
|
||||||
options="-d -n -s -t --"
|
options="-d -n -s -t --"
|
||||||
|
|
@ -174,7 +188,8 @@ _tmux() {
|
||||||
fi # command specified
|
fi # command specified
|
||||||
fi # not -f
|
fi # not -f
|
||||||
|
|
||||||
if [[ -n "${options}" ]]; then
|
if [[ -n "${options}" ]]
|
||||||
|
then
|
||||||
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${options}" -- "${cur}") )
|
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${options}" -- "${cur}") )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
__pwdln() {
|
function __pwdln() {
|
||||||
pwdmod="${PWD}/"
|
pwdmod="${PWD}/"
|
||||||
itr=0
|
itr=0
|
||||||
until [[ -z "$pwdmod" ]];do
|
until [[ -z "$pwdmod" ]];do
|
||||||
|
|
@ -33,7 +33,7 @@ __pwdln() {
|
||||||
echo -n $(($itr-1))
|
echo -n $(($itr-1))
|
||||||
}
|
}
|
||||||
|
|
||||||
__vagrantinvestigate() {
|
function __vagrantinvestigate() {
|
||||||
if [ -f "${PWD}/.vagrant" -o -d "${PWD}/.vagrant" ];then
|
if [ -f "${PWD}/.vagrant" -o -d "${PWD}/.vagrant" ];then
|
||||||
echo "${PWD}/.vagrant"
|
echo "${PWD}/.vagrant"
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -50,7 +50,7 @@ __vagrantinvestigate() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
_vagrant() {
|
function _vagrant() {
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
commands="box cloud destroy global-status halt help hostmanager init login package plugin port powershell provision push rdp reload resume scp snapshot ssh ssh-config status suspend up upload validate vbguest version winrm winrm-config"
|
commands="box cloud destroy global-status halt help hostmanager init login package plugin port powershell provision push rdp reload resume scp snapshot ssh ssh-config status suspend up upload validate vbguest version winrm winrm-config"
|
||||||
|
|
@ -119,7 +119,8 @@ _vagrant() {
|
||||||
action="${COMP_WORDS[COMP_CWORD-2]}"
|
action="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
case "$action" in
|
case "$action" in
|
||||||
"up")
|
"up")
|
||||||
if [ "$prev" == "--no-provision" ]; then
|
if [ "$prev" == "--no-provision" ]
|
||||||
|
then
|
||||||
COMPREPLY=($(compgen -W "${vm_list}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${vm_list}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -135,7 +136,8 @@ _vagrant() {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
"snapshot")
|
"snapshot")
|
||||||
if [ "$prev" == "restore" ]; then
|
if [ "$prev" == "restore" ]
|
||||||
|
then
|
||||||
COMPREPLY=($(compgen -W "${vm_list}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${vm_list}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -149,7 +151,8 @@ _vagrant() {
|
||||||
prev="${COMP_WORDS[COMP_CWORD-2]}"
|
prev="${COMP_WORDS[COMP_CWORD-2]}"
|
||||||
case "$action" in
|
case "$action" in
|
||||||
"snapshot")
|
"snapshot")
|
||||||
if [ "$prev" == "restore" ]; then
|
if [ "$prev" == "restore" ]
|
||||||
|
then
|
||||||
local snapshot_list="$(vagrant snapshot list ${cur} 2>/dev/null | awk '{ORS=" "} /==>/ {next} {print}')"
|
local snapshot_list="$(vagrant snapshot list ${cur} 2>/dev/null | awk '{ORS=" "} /==>/ {next} {print}')"
|
||||||
COMPREPLY=($(compgen -W "${snapshot_list}" -- ${cur}))
|
COMPREPLY=($(compgen -W "${snapshot_list}" -- ${cur}))
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "vault completion"
|
about-completion "vault completion"
|
||||||
|
|
||||||
if _binary_exists vault; then
|
if _binary_exists vault
|
||||||
|
then
|
||||||
complete -C vault vault
|
complete -C vault vault
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
_vboxmanage_realopts() {
|
function _vboxmanage_realopts() {
|
||||||
echo $(vboxmanage|grep -i vboxmanage|cut -d' ' -f2|grep '\['|tr -s '[\[\|\]\n' ' ')
|
echo $(vboxmanage|grep -i vboxmanage|cut -d' ' -f2|grep '\['|tr -s '[\[\|\]\n' ' ')
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
|
|
||||||
__vboxmanage_startvm() {
|
function __vboxmanage_startvm() {
|
||||||
RUNNING=$(vboxmanage list runningvms | cut -d' ' -f1 | tr -d '"')
|
RUNNING=$(vboxmanage list runningvms | cut -d' ' -f1 | tr -d '"')
|
||||||
TOTAL=$(vboxmanage list vms | cut -d' ' -f1 | tr -d '"')
|
TOTAL=$(vboxmanage list vms | cut -d' ' -f1 | tr -d '"')
|
||||||
|
|
||||||
|
|
@ -12,7 +12,8 @@ __vboxmanage_startvm() {
|
||||||
for VM in $TOTAL; do
|
for VM in $TOTAL; do
|
||||||
MATCH=0;
|
MATCH=0;
|
||||||
for RUN in $RUNNING "x"; do
|
for RUN in $RUNNING "x"; do
|
||||||
if [ "$VM" == "$RUN" ]; then
|
if [ "$VM" == "$RUN" ]
|
||||||
|
then
|
||||||
MATCH=1
|
MATCH=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -21,11 +22,12 @@ __vboxmanage_startvm() {
|
||||||
echo $AVAILABLE
|
echo $AVAILABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
__vboxmanage_list() {
|
function __vboxmanage_list() {
|
||||||
INPUT=$(vboxmanage list | tr -s '[\[\]\|\n]' ' ' | cut -d' ' -f4-)
|
INPUT=$(vboxmanage list | tr -s '[\[\]\|\n]' ' ' | cut -d' ' -f4-)
|
||||||
|
|
||||||
PRUNED=""
|
PRUNED=""
|
||||||
if [ "$1" == "long" ]; then
|
if [ "${1}" == "long" ]
|
||||||
|
then
|
||||||
for WORD in $INPUT; do
|
for WORD in $INPUT; do
|
||||||
[ "$WORD" == "-l" ] && continue;
|
[ "$WORD" == "-l" ] && continue;
|
||||||
[ "$WORD" == "--long" ] && continue;
|
[ "$WORD" == "--long" ] && continue;
|
||||||
|
|
@ -40,9 +42,10 @@ __vboxmanage_list() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__vboxmanage_list_vms() {
|
function __vboxmanage_list_vms() {
|
||||||
VMS=""
|
VMS=""
|
||||||
if [ "x$1" == "x" ]; then
|
if [ "x$1" == "x" ]
|
||||||
|
then
|
||||||
SEPARATOR=" "
|
SEPARATOR=" "
|
||||||
else
|
else
|
||||||
SEPARATOR=$1
|
SEPARATOR=$1
|
||||||
|
|
@ -56,9 +59,10 @@ __vboxmanage_list_vms() {
|
||||||
echo $VMS
|
echo $VMS
|
||||||
}
|
}
|
||||||
|
|
||||||
__vboxmanage_list_runningvms() {
|
function __vboxmanage_list_runningvms() {
|
||||||
VMS=""
|
VMS=""
|
||||||
if [ "$1" == "" ]; then
|
if [ "${1}" == "" ]
|
||||||
|
then
|
||||||
SEPARATOR=" "
|
SEPARATOR=" "
|
||||||
else
|
else
|
||||||
SEPARATOR=$1
|
SEPARATOR=$1
|
||||||
|
|
@ -73,7 +77,7 @@ __vboxmanage_list_runningvms() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__vboxmanage_controlvm() {
|
function __vboxmanage_controlvm() {
|
||||||
echo "pause resume reset poweroff savestate acpipowerbutton"
|
echo "pause resume reset poweroff savestate acpipowerbutton"
|
||||||
echo "acpisleepbutton keyboardputscancode guestmemoryballoon"
|
echo "acpisleepbutton keyboardputscancode guestmemoryballoon"
|
||||||
echo "gueststatisticsinterval usbattach usbdetach vrde vrdeport"
|
echo "gueststatisticsinterval usbattach usbdetach vrde vrdeport"
|
||||||
|
|
@ -93,7 +97,7 @@ __vboxmanage_controlvm() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__vboxmanage_default() {
|
function __vboxmanage_default() {
|
||||||
realopts=$(_vboxmanage_realopts)
|
realopts=$(_vboxmanage_realopts)
|
||||||
opts=$realopts$(vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | grep -v '\[' | sort | uniq)
|
opts=$realopts$(vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | grep -v '\[' | sort | uniq)
|
||||||
pruned=""
|
pruned=""
|
||||||
|
|
@ -113,23 +117,28 @@ __vboxmanage_default() {
|
||||||
MATCH=0
|
MATCH=0
|
||||||
for OPT in "${COMP_WORDS[@]}"; do
|
for OPT in "${COMP_WORDS[@]}"; do
|
||||||
# opts=$(echo ${opts} | grep -v $OPT);
|
# opts=$(echo ${opts} | grep -v $OPT);
|
||||||
if [ "$OPT" == "$WORD" ]; then
|
if [ "$OPT" == "$WORD" ]
|
||||||
|
then
|
||||||
MATCH=1
|
MATCH=1
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
if [ "$OPT" == "-v" ] && [ "$WORD" == "--version" ]; then
|
if [ "$OPT" == "-v" ] && [ "$WORD" == "--version" ]
|
||||||
|
then
|
||||||
MATCH=1
|
MATCH=1
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
if [ "$OPT" == "--version" ] && [ "$WORD" == "-v" ]; then
|
if [ "$OPT" == "--version" ] && [ "$WORD" == "-v" ]
|
||||||
|
then
|
||||||
MATCH=1
|
MATCH=1
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
if [ "$OPT" == "-q" ] && [ "$WORD" == "--nologo" ]; then
|
if [ "$OPT" == "-q" ] && [ "$WORD" == "--nologo" ]
|
||||||
|
then
|
||||||
MATCH=1
|
MATCH=1
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
if [ "$OPT" == "--nologo" ] && [ "$WORD" == "-q" ]; then
|
if [ "$OPT" == "--nologo" ] && [ "$WORD" == "-q" ]
|
||||||
|
then
|
||||||
MATCH=1
|
MATCH=1
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
|
|
@ -144,7 +153,7 @@ __vboxmanage_default() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
_vboxmanage() {
|
function _vboxmanage() {
|
||||||
# vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | sort | uniq
|
# vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | sort | uniq
|
||||||
local cur p1 p2 p3 p4 opts
|
local cur p1 p2 p3 p4 opts
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
|
|
@ -199,7 +208,8 @@ _vboxmanage() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
for VM in $(__vboxmanage_list_vms); do
|
for VM in $(__vboxmanage_list_vms); do
|
||||||
if [ "$VM" == "$prev" ]; then
|
if [ "$VM" == "$prev" ]
|
||||||
|
then
|
||||||
pprev=${COMP_WORDS[COMP_CWORD-2]}
|
pprev=${COMP_WORDS[COMP_CWORD-2]}
|
||||||
# echo "previous: $pprev"
|
# echo "previous: $pprev"
|
||||||
case $pprev in
|
case $pprev in
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,18 @@
|
||||||
|
|
||||||
_command_exists wpscan || return
|
_command_exists wpscan || return
|
||||||
|
|
||||||
function __wpscan_completion() {
|
function __wpscan_completion()
|
||||||
|
{
|
||||||
|
############ STACK_TRACE_BUILDER #####################
|
||||||
|
Function_Name="${FUNCNAME[0]}"
|
||||||
|
Function_PATH="${Function_PATH}/${Function_Name}"
|
||||||
|
######################################################
|
||||||
local _opt_
|
local _opt_
|
||||||
local OPTS=('--help' '--hh' '--version' '--url' '--ignore-main-redirect' '--verbose' '--output' '--format' '--detection-mode' '--scope' '--headers' '--user-agent' '--vhost' '--random-user-agent' '--user-agents-list' '--http-auth' '--max-threads' '--throttle' '--request-timeout' '--connect-timeout' '--disable-tlc-checks' '--proxy' '--proxy-auth' '--cookie-string' '--cookie-jar' '--cache-ttl' '--clear-cache' '--server' '--cache-dir' '--update' '--no-update' '--wp-content-dir' '--wp-plugins-dir' '--wp-version-detection' '--main-theme-detection' '--enumerate' '--exclude-content-based' '--plugins-list' '--plugins-detection' '--plugins-version-all' '--plugins-version-detection' '--themes-list' '--themes-detection' '--themes-version-all' '--themes-version-detection' '--timthumbs-list' '--timthumbs-detection' '--config-backups-list' '--config-backups-detection' '--db-exports-list' '--db-exports-detection' '--medias-detection' '--users-list' '--users-detection' '--passwords' '--usernames' '--multicall-max-passwords' '--password-attack' '--stealthy')
|
local OPTS=('--help' '--hh' '--version' '--url' '--ignore-main-redirect' '--verbose' '--output' '--format' '--detection-mode' '--scope' '--headers' '--user-agent' '--vhost' '--random-user-agent' '--user-agents-list' '--http-auth' '--max-threads' '--throttle' '--request-timeout' '--connect-timeout' '--disable-tlc-checks' '--proxy' '--proxy-auth' '--cookie-string' '--cookie-jar' '--cache-ttl' '--clear-cache' '--server' '--cache-dir' '--update' '--no-update' '--wp-content-dir' '--wp-plugins-dir' '--wp-version-detection' '--main-theme-detection' '--enumerate' '--exclude-content-based' '--plugins-list' '--plugins-detection' '--plugins-version-all' '--plugins-version-detection' '--themes-list' '--themes-detection' '--themes-version-all' '--themes-version-detection' '--timthumbs-list' '--timthumbs-detection' '--config-backups-list' '--config-backups-detection' '--db-exports-list' '--db-exports-detection' '--medias-detection' '--users-list' '--users-detection' '--passwords' '--usernames' '--multicall-max-passwords' '--password-attack' '--stealthy')
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
for _opt_ in "${OPTS[@]}"; do
|
for _opt_ in "${OPTS[@]}"; do
|
||||||
if [[ "$_opt_" == "$2"* ]]; then
|
if [[ "$_opt_" == "${2}"* ]]
|
||||||
|
then
|
||||||
COMPREPLY+=("$_opt_")
|
COMPREPLY+=("$_opt_")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
# Minimal makefile for Sphinx documentation
|
# Minimal makefile for Sphinx documentation
|
||||||
#
|
#
|
||||||
|
|
||||||
# You can set these variables from the command line, and also
|
# You can set these variables from the command line, and also
|
||||||
# from the environment for the first two.
|
# from the environment for the first two.
|
||||||
SPHINXOPTS ?=
|
SPHINXOPTS ?=
|
||||||
SPHINXBUILD ?= sphinx-build
|
SPHINXBUILD ?= sphinx-build
|
||||||
SOURCEDIR = .
|
SOURCEDIR = .
|
||||||
BUILDDIR = _build
|
BUILDDIR = _build
|
||||||
|
|
||||||
# Put it first so that "make" without argument is like "make help".
|
# Put it first so that "make" without argument is like "make help".
|
||||||
help:
|
help:
|
||||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
.PHONY: help Makefile
|
.PHONY: help Makefile
|
||||||
|
|
||||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
%: Makefile
|
%: Makefile
|
||||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
|
||||||
126
docs/README.md
126
docs/README.md
|
|
@ -1,63 +1,63 @@
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
|
**Bash-it** is a collection of community Bash commands and scripts for Bash 3.2+.
|
||||||
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:)
|
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) :smiley:)
|
||||||
|
|
||||||
Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more.
|
Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more.
|
||||||
|
|
||||||
Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work.
|
Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work.
|
||||||
If you're using the _Bourne Again Shell_ (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
|
If you're using the _Bourne Again Shell_ (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
|
||||||
Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-it and start hacking away.
|
Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-it and start hacking away.
|
||||||
|
|
||||||
- [Main Page](https://bash-it.readthedocs.io/en/latest)
|
- [Main Page](https://bash-it.readthedocs.io/en/latest)
|
||||||
- [Contributing](#contributing)
|
- [Contributing](#contributing)
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Install Options](https://bash-it.readthedocs.io/en/latest/installation/#install-options)
|
- [Install Options](https://bash-it.readthedocs.io/en/latest/installation/#install-options)
|
||||||
- [via Docker](https://bash-it.readthedocs.io/en/latest/installation/#install-using-docker)
|
- [via Docker](https://bash-it.readthedocs.io/en/latest/installation/#install-using-docker)
|
||||||
- [Updating](https://bash-it.readthedocs.io/en/latest/installation/#updating)
|
- [Updating](https://bash-it.readthedocs.io/en/latest/installation/#updating)
|
||||||
- [Help](https://bash-it.readthedocs.io/en/latest/misc/#help-screens)
|
- [Help](https://bash-it.readthedocs.io/en/latest/misc/#help-screens)
|
||||||
- [Search](https://bash-it.readthedocs.io/en/latest/commands/search)
|
- [Search](https://bash-it.readthedocs.io/en/latest/commands/search)
|
||||||
- [Syntax](https://bash-it.readthedocs.io/en/latest/commands/search/#syntax)
|
- [Syntax](https://bash-it.readthedocs.io/en/latest/commands/search/#syntax)
|
||||||
- [Searching with Negations](
|
- [Searching with Negations](
|
||||||
https://bash-it.readthedocs.io/en/latest/commands/search/#searching-with-negations)
|
https://bash-it.readthedocs.io/en/latest/commands/search/#searching-with-negations)
|
||||||
- [Using Search to Enable or Disable Components](https://bash-it.readthedocs.io/en/latest/commands/search/#using-search-to-enable-or-disable-components)
|
- [Using Search to Enable or Disable Components](https://bash-it.readthedocs.io/en/latest/commands/search/#using-search-to-enable-or-disable-components)
|
||||||
- [Disabling ASCII Color](https://bash-it.readthedocs.io/en/latest/commands/search/#disabling-ascii-color)
|
- [Disabling ASCII Color](https://bash-it.readthedocs.io/en/latest/commands/search/#disabling-ascii-color)
|
||||||
- [Custom scripts, aliases, themes, and functions](
|
- [Custom scripts, aliases, themes, and functions](
|
||||||
https://bash-it.readthedocs.io/en/latest/custom)
|
https://bash-it.readthedocs.io/en/latest/custom)
|
||||||
- [Themes](https://bash-it.readthedocs.io/en/latest/themes)
|
- [Themes](https://bash-it.readthedocs.io/en/latest/themes)
|
||||||
- [Uninstalling](https://bash-it.readthedocs.io/en/latest/uninstalling)
|
- [Uninstalling](https://bash-it.readthedocs.io/en/latest/uninstalling)
|
||||||
- [Misc](https://bash-it.readthedocs.io/en/latest/misc)
|
- [Misc](https://bash-it.readthedocs.io/en/latest/misc)
|
||||||
- [Help Out](https://bash-it.readthedocs.io/en/latest/#help-out)
|
- [Help Out](https://bash-it.readthedocs.io/en/latest/#help-out)
|
||||||
- [Contributors](#contributors)
|
- [Contributors](#contributors)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1) Check out a clone of this repo to a location of your choice, such as
|
1) Check out a clone of this repo to a location of your choice, such as
|
||||||
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
|
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
|
||||||
2) Run ``~/.bash_it/install.sh``
|
2) Run ``~/.bash_it/install.sh``
|
||||||
|
|
||||||
That's it! :smiley:
|
That's it! :smiley:
|
||||||
|
|
||||||
You can check out more components of Bash-it, and customize it to your desire.
|
You can check out more components of Bash-it, and customize it to your desire.
|
||||||
For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/).
|
For more information, see detailed instructions [here](https://bash-it.readthedocs.io/en/latest/installation/).
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Please take a look at the [Contribution Guidelines](https://bash-it.readthedocs.io/en/latest/contributing) before reporting a bug or providing a new feature.
|
Please take a look at the [Contribution Guidelines](https://bash-it.readthedocs.io/en/latest/contributing) before reporting a bug or providing a new feature.
|
||||||
|
|
||||||
The [Development Guidelines](https://bash-it.readthedocs.io/en/latest/development) have more information on some of the internal workings of Bash-it,
|
The [Development Guidelines](https://bash-it.readthedocs.io/en/latest/development) have more information on some of the internal workings of Bash-it,
|
||||||
please feel free to read through this page if you're interested in how Bash-it loads its components.
|
please feel free to read through this page if you're interested in how Bash-it loads its components.
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
[List of contributors](https://github.com/Bash-it/bash-it/contributors)
|
[List of contributors](https://github.com/Bash-it/bash-it/contributors)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Bash-it is licensed under the [MIT License](https://github.com/Bash-it/bash-it/blob/master/LICENSE).
|
Bash-it is licensed under the [MIT License](https://github.com/Bash-it/bash-it/blob/master/LICENSE).
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
.. _doctor:
|
.. _doctor:
|
||||||
|
|
||||||
Bash-it doctor
|
Bash-it doctor
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If you encounter problems with any part of Bash-it, run the following command:
|
If you encounter problems with any part of Bash-it, run the following command:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash-it doctor
|
bash-it doctor
|
||||||
|
|
||||||
This will reload your bash profile and print out logs of various parts in Bash-it.
|
This will reload your bash profile and print out logs of various parts in Bash-it.
|
||||||
Note that this command at default will print all logs, including debug logs.
|
Note that this command at default will print all logs, including debug logs.
|
||||||
You can call it like this:
|
You can call it like this:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash-it doctor [errors/warnings/all]
|
bash-it doctor [errors/warnings/all]
|
||||||
|
|
||||||
In order to get wanted verbosity.
|
In order to get wanted verbosity.
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
.. _commands:
|
.. _commands:
|
||||||
|
|
||||||
Bash-it Commands
|
Bash-it Commands
|
||||||
================
|
================
|
||||||
|
|
||||||
**Bash-it** boasts a wide range of available commands.
|
**Bash-it** boasts a wide range of available commands.
|
||||||
You should be familiar with them in order to fully utilize Bash-it.
|
You should be familiar with them in order to fully utilize Bash-it.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
update
|
update
|
||||||
search
|
search
|
||||||
reload
|
reload
|
||||||
doctor
|
doctor
|
||||||
profile
|
profile
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
.. _profile:
|
.. _profile:
|
||||||
|
|
||||||
Bash-it Profile
|
Bash-it Profile
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Have you ever wanted to port your *Bash-it* configuration into another machine?
|
Have you ever wanted to port your *Bash-it* configuration into another machine?
|
||||||
|
|
||||||
If you did, then ``bash-it profile`` is for you!
|
If you did, then ``bash-it profile`` is for you!
|
||||||
|
|
||||||
This command can save and load custom *"profile"* files, that can be later
|
This command can save and load custom *"profile"* files, that can be later
|
||||||
used to load and recreate your configuration, in any machine you would like |:smile:|
|
used to load and recreate your configuration, in any machine you would like |:smile:|
|
||||||
|
|
||||||
When porting your configuration into a new machine, you just need to save your current profile, copy the resulting *"profile"* file, and load it in the other machine.
|
When porting your configuration into a new machine, you just need to save your current profile, copy the resulting *"profile"* file, and load it in the other machine.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Saves your current profile
|
# Saves your current profile
|
||||||
bash-it profile save my_profile
|
bash-it profile save my_profile
|
||||||
# Load the default profile, which is the one used in the default installation.
|
# Load the default profile, which is the one used in the default installation.
|
||||||
bash-it profile load default
|
bash-it profile load default
|
||||||
|
|
||||||
# Do whatever you want:
|
# Do whatever you want:
|
||||||
# Disable stuff
|
# Disable stuff
|
||||||
bash-it disable ...
|
bash-it disable ...
|
||||||
# Enable stuff
|
# Enable stuff
|
||||||
bash-it enable ...
|
bash-it enable ...
|
||||||
# If you want to get back into your original configuration, you can do it easily
|
# If you want to get back into your original configuration, you can do it easily
|
||||||
bash-it profile load my_profile
|
bash-it profile load my_profile
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
.. _reload:
|
.. _reload:
|
||||||
|
|
||||||
Bash-it reload
|
Bash-it reload
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Bash-it creates a ``reload`` alias that makes it convenient to reload
|
Bash-it creates a ``reload`` alias that makes it convenient to reload
|
||||||
your Bash profile when you make changes.
|
your Bash profile when you make changes.
|
||||||
|
|
||||||
Additionally, if you export ``BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE`` as a non-null value,
|
Additionally, if you export ``BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE`` as a non-null value,
|
||||||
Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions.
|
Bash-it will automatically reload itself after activating or deactivating plugins, aliases, or completions.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
When changing theme, do not use ``bash-it reload``. Instead, use :ref:`restart`.
|
When changing theme, do not use ``bash-it reload``. Instead, use :ref:`restart`.
|
||||||
|
|
||||||
.. _restart:
|
.. _restart:
|
||||||
|
|
||||||
Bash-it restart
|
Bash-it restart
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Similar to :ref:`reload`, ``bash-it restart`` can be used to restart your shell.
|
Similar to :ref:`reload`, ``bash-it restart`` can be used to restart your shell.
|
||||||
Instead of reloading your Bash profile, this command re-runs Bash (using exec).
|
Instead of reloading your Bash profile, this command re-runs Bash (using exec).
|
||||||
|
|
||||||
This is stronger than simple reload, and is similar to the effect of closing and reopening your terminal.
|
This is stronger than simple reload, and is similar to the effect of closing and reopening your terminal.
|
||||||
|
|
|
||||||
|
|
@ -1,59 +1,59 @@
|
||||||
.. _searching:
|
.. _searching:
|
||||||
|
|
||||||
Bash-it search
|
Bash-it search
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
If you need to quickly find out which of the plugins, aliases or completions are available for a specific framework, programming language, or an environment, you can *search* for multiple terms related to the commands you use frequently.
|
If you need to quickly find out which of the plugins, aliases or completions are available for a specific framework, programming language, or an environment, you can *search* for multiple terms related to the commands you use frequently.
|
||||||
Search will find and print out modules with the name or description matching the terms provided.
|
Search will find and print out modules with the name or description matching the terms provided.
|
||||||
|
|
||||||
Syntax
|
Syntax
|
||||||
^^^^^^
|
^^^^^^
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash-it search term1 [[-]term2] [[-]term3]....
|
bash-it search term1 [[-]term2] [[-]term3]....
|
||||||
|
|
||||||
As an example, a ruby developer might want to enable everything related to the commands such as ``ruby``\ , ``rake``\ , ``gem``\ , ``bundler``\ , and ``rails``.
|
As an example, a ruby developer might want to enable everything related to the commands such as ``ruby``\ , ``rake``\ , ``gem``\ , ``bundler``\ , and ``rails``.
|
||||||
Search command helps you find related modules so that you can decide which of them you'd like to use:
|
Search command helps you find related modules so that you can decide which of them you'd like to use:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
❯ bash-it search ruby rake gem bundle irb rails
|
❯ bash-it search ruby rake gem bundle irb rails
|
||||||
aliases: bundler rails
|
aliases: bundler rails
|
||||||
plugins: chruby chruby-auto ruby
|
plugins: chruby chruby-auto ruby
|
||||||
completions: bundler gem rake
|
completions: bundler gem rake
|
||||||
|
|
||||||
Currently enabled modules will be shown in green.
|
Currently enabled modules will be shown in green.
|
||||||
|
|
||||||
Searching with Negations
|
Searching with Negations
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
You can prefix a search term with a "-" to exclude it from the results.
|
You can prefix a search term with a "-" to exclude it from the results.
|
||||||
In the above example, if we wanted to hide ``chruby`` and ``chruby-auto``\ ,
|
In the above example, if we wanted to hide ``chruby`` and ``chruby-auto``\ ,
|
||||||
we could change the command as follows:
|
we could change the command as follows:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
❯ bash-it search ruby rake gem bundle irb rails -chruby
|
❯ bash-it search ruby rake gem bundle irb rails -chruby
|
||||||
aliases: bundler rails
|
aliases: bundler rails
|
||||||
plugins: ruby
|
plugins: ruby
|
||||||
completions: bundler gem rake
|
completions: bundler gem rake
|
||||||
|
|
||||||
Using Search to Enable or Disable Components
|
Using Search to Enable or Disable Components
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
By adding a ``--enable`` or ``--disable`` to the search command, you can automatically enable all modules that come up as a result of a search query.
|
By adding a ``--enable`` or ``--disable`` to the search command, you can automatically enable all modules that come up as a result of a search query.
|
||||||
This could be quite handy if you like to enable a bunch of components related to the same topic.
|
This could be quite handy if you like to enable a bunch of components related to the same topic.
|
||||||
|
|
||||||
Disabling ASCII Color
|
Disabling ASCII Color
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
To remove non-printing non-ASCII characters responsible for the coloring of the search output, you can set environment variable ``NO_COLOR``.
|
To remove non-printing non-ASCII characters responsible for the coloring of the search output, you can set environment variable ``NO_COLOR``.
|
||||||
Enabled components will then be shown with a checkmark:
|
Enabled components will then be shown with a checkmark:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
❯ NO_COLOR=1 bash-it search ruby rake gem bundle irb rails -chruby
|
❯ NO_COLOR=1 bash-it search ruby rake gem bundle irb rails -chruby
|
||||||
aliases => ✓bundler ✓rails
|
aliases => ✓bundler ✓rails
|
||||||
plugins => ✓ruby
|
plugins => ✓ruby
|
||||||
completions => bundler gem rake
|
completions => bundler gem rake
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,38 @@
|
||||||
.. _update:
|
.. _update:
|
||||||
|
|
||||||
Bash-it update
|
Bash-it update
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
To update Bash-it to the latest stable version, simply run:
|
To update Bash-it to the latest stable version, simply run:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash-it update stable
|
bash-it update stable
|
||||||
|
|
||||||
If you want to update to the latest dev version (directly from master), run:
|
If you want to update to the latest dev version (directly from master), run:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash-it update dev
|
bash-it update dev
|
||||||
|
|
||||||
If you want to update automatically and unattended, you can add the optional
|
If you want to update automatically and unattended, you can add the optional
|
||||||
``-s/--silent`` flag, for example:
|
``-s/--silent`` flag, for example:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash-it update dev --silent
|
bash-it update dev --silent
|
||||||
|
|
||||||
.. _migrate:
|
.. _migrate:
|
||||||
|
|
||||||
Bash-it migrate
|
Bash-it migrate
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If you are using an older version of Bash-it, it's possible that some functionality has changed, or that the internal structure of how Bash-it organizes its functionality has been updated.
|
If you are using an older version of Bash-it, it's possible that some functionality has changed, or that the internal structure of how Bash-it organizes its functionality has been updated.
|
||||||
For these cases, we provide a ``migrate`` command:
|
For these cases, we provide a ``migrate`` command:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
bash-it migrate
|
bash-it migrate
|
||||||
|
|
||||||
This command will automatically migrate the Bash-it structure to the latest version.
|
This command will automatically migrate the Bash-it structure to the latest version.
|
||||||
The ``migrate`` command is run automatically if you run the ``update``\ , ``enable`` or ``disable`` commands.
|
The ``migrate`` command is run automatically if you run the ``update``\ , ``enable`` or ``disable`` commands.
|
||||||
|
|
|
||||||
108
docs/conf.py
108
docs/conf.py
|
|
@ -1,54 +1,54 @@
|
||||||
# Configuration file for the Sphinx documentation builder.
|
# Configuration file for the Sphinx documentation builder.
|
||||||
#
|
#
|
||||||
# This file only contains a selection of the most common options. For a full
|
# This file only contains a selection of the most common options. For a full
|
||||||
# list see the documentation:
|
# list see the documentation:
|
||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||||
|
|
||||||
# -- Path setup --------------------------------------------------------------
|
# -- Path setup --------------------------------------------------------------
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
#
|
#
|
||||||
# import os
|
# import os
|
||||||
# import sys
|
# import sys
|
||||||
# sys.path.insert(0, os.path.abspath('.'))
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
# -- Project information -----------------------------------------------------
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
project = 'Bash-it'
|
project = 'Bash-it'
|
||||||
copyright = '2020, Bash-it Team'
|
copyright = '2020, Bash-it Team'
|
||||||
author = 'Bash-it Team'
|
author = 'Bash-it Team'
|
||||||
|
|
||||||
# The full version, including alpha/beta/rc tags
|
# The full version, including alpha/beta/rc tags
|
||||||
release = ''
|
release = ''
|
||||||
|
|
||||||
# -- General configuration ---------------------------------------------------
|
# -- General configuration ---------------------------------------------------
|
||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
# ones.
|
# ones.
|
||||||
extensions = [
|
extensions = [
|
||||||
'sphinx_rtd_theme',
|
'sphinx_rtd_theme',
|
||||||
'sphinxemoji.sphinxemoji',
|
'sphinxemoji.sphinxemoji',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ['_templates']
|
templates_path = ['_templates']
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
# This pattern also affects html_static_path and html_extra_path.
|
# This pattern also affects html_static_path and html_extra_path.
|
||||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', "venv"]
|
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', "venv"]
|
||||||
|
|
||||||
# -- Options for HTML output -------------------------------------------------
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
|
||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
# a list of builtin themes.
|
# a list of builtin themes.
|
||||||
#
|
#
|
||||||
html_theme = 'sphinx_rtd_theme'
|
html_theme = 'sphinx_rtd_theme'
|
||||||
|
|
||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = ['_static']
|
html_static_path = ['_static']
|
||||||
|
|
|
||||||
|
|
@ -1,115 +1,115 @@
|
||||||
.. _contributing:
|
.. _contributing:
|
||||||
|
|
||||||
Contribution Guidelines
|
Contribution Guidelines
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
When contributing a new feature, a bug fix, a new theme, or any other change to Bash-it, please consider the following guidelines.
|
When contributing a new feature, a bug fix, a new theme, or any other change to Bash-it, please consider the following guidelines.
|
||||||
Most of this is common sense, but please try to stick to the conventions listed here.
|
Most of this is common sense, but please try to stick to the conventions listed here.
|
||||||
|
|
||||||
Issues
|
Issues
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|
||||||
* When reporting a bug or requesting a new feature, consider providing a Pull Request that fixes the issue or can be used as a starting point for the new feature.
|
* When reporting a bug or requesting a new feature, consider providing a Pull Request that fixes the issue or can be used as a starting point for the new feature.
|
||||||
Don't be afraid, most things aren't that complex...
|
Don't be afraid, most things aren't that complex...
|
||||||
|
|
||||||
Pull Requests
|
Pull Requests
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
||||||
* Fork the Bash-it repo, create a new feature branch from *master* and apply your changes there.
|
* Fork the Bash-it repo, create a new feature branch from *master* and apply your changes there.
|
||||||
Create a *Pull Request* from your feature branch against Bash-it's *master* branch.
|
Create a *Pull Request* from your feature branch against Bash-it's *master* branch.
|
||||||
* Limit each Pull Request to one feature.
|
* Limit each Pull Request to one feature.
|
||||||
Don't bundle multiple features/changes (e.g. a new *Theme* and a fix to an existing plugin) into a single Pull Request - create one PR for the theme, and a separate PR for the fix.
|
Don't bundle multiple features/changes (e.g. a new *Theme* and a fix to an existing plugin) into a single Pull Request - create one PR for the theme, and a separate PR for the fix.
|
||||||
* For complex changes, try to *squash* your changes into a single commit before
|
* For complex changes, try to *squash* your changes into a single commit before
|
||||||
pushing code. Once you've pushed your code and opened a PR, please refrain
|
pushing code. Once you've pushed your code and opened a PR, please refrain
|
||||||
from force-pushing changes to the PR branch – remember, Bash-it is a
|
from force-pushing changes to the PR branch – remember, Bash-it is a
|
||||||
distributed project and your branch may be in use already.
|
distributed project and your branch may be in use already.
|
||||||
* When in doubt, open a PR with too many commits. Bash-it is a learning project
|
* When in doubt, open a PR with too many commits. Bash-it is a learning project
|
||||||
for everyone involved. Showing your work provides a great history for folks
|
for everyone involved. Showing your work provides a great history for folks
|
||||||
to learn what works and what didn't.
|
to learn what works and what didn't.
|
||||||
|
|
||||||
Code Style
|
Code Style
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|
||||||
* When adding new files, be sure to add them into `clean_files.txt`, which is a growing list of linted files in the project.
|
* When adding new files, be sure to add them into `clean_files.txt`, which is a growing list of linted files in the project.
|
||||||
* When changing existing files, consider also adding them into `clean_files.txt` and fixing the linting errors that arise. See :ref:`linting_your_changes` for more information.
|
* When changing existing files, consider also adding them into `clean_files.txt` and fixing the linting errors that arise. See :ref:`linting_your_changes` for more information.
|
||||||
* Indentation is using tabs, not spaces. Most of the code is indented with 2 spaces, some with 4 spaced tabs. Please try to stick to tabs.
|
* Indentation is using tabs, not spaces. Most of the code is indented with 2 spaces, some with 4 spaced tabs. Please try to stick to tabs.
|
||||||
If you're using an editor that supports `EditorConfig <http://EditorConfig.org>`_\ , the editor should automatically use the settings defined in Bash-it's `.editorconfig file <.editorconfig>`_.
|
If you're using an editor that supports `EditorConfig <http://EditorConfig.org>`_\ , the editor should automatically use the settings defined in Bash-it's `.editorconfig file <.editorconfig>`_.
|
||||||
* Prefer to invoke commands directly using the ``command`` shell builtin. This way, your code
|
* Prefer to invoke commands directly using the ``command`` shell builtin. This way, your code
|
||||||
will always execute the command you wanted and not an alias/function that overrides the name of the command. (For example, use ``command rm`` instead of ``rm``)
|
will always execute the command you wanted and not an alias/function that overrides the name of the command. (For example, use ``command rm`` instead of ``rm``)
|
||||||
* When creating new functions, please use a dash ("-") to separate the words of the function's name, e.g. ``my-new-function``.
|
* When creating new functions, please use a dash ("-") to separate the words of the function's name, e.g. ``my-new-function``.
|
||||||
Don't use underscores, e.g. ``my_new_function``.
|
Don't use underscores, e.g. ``my_new_function``.
|
||||||
* Internal functions that aren't to be used by the end user should start with an underscore, e.g. ``_my-new-internal-function``.
|
* Internal functions that aren't to be used by the end user should start with an underscore, e.g. ``_my-new-internal-function``.
|
||||||
* Use the provided meta functions to document your code, e.g. ``about-plugin``\ , ``about``\ , ``group``\ , ``param``\ , ``example``.
|
* Use the provided meta functions to document your code, e.g. ``about-plugin``\ , ``about``\ , ``group``\ , ``param``\ , ``example``.
|
||||||
This will make it easier for other people to use your new functionality.
|
This will make it easier for other people to use your new functionality.
|
||||||
Take a look at the existing code for an example (e.g. `the base plugin <plugins/available/base.plugin.bash>`_\ ).
|
Take a look at the existing code for an example (e.g. `the base plugin <plugins/available/base.plugin.bash>`_\ ).
|
||||||
* When adding files, please use the existing file naming conventions, e.g. plugin files need to end in ``.plugin.bash``.
|
* When adding files, please use the existing file naming conventions, e.g. plugin files need to end in ``.plugin.bash``.
|
||||||
This is important for the installation functionality.
|
This is important for the installation functionality.
|
||||||
* When using the ``$BASH_IT`` variable, please always enclose it in double quotes to ensure that the code also works when Bash-it is installed in a directory that contains spaces in its name: ``for f in "${BASH_IT}/plugins/available"/*.bash ; do echo "$f" ; done``
|
* When using the ``$BASH_IT`` variable, please always enclose it in double quotes to ensure that the code also works when Bash-it is installed in a directory that contains spaces in its name: ``for f in "${BASH_IT}/plugins/available"/*.bash ; do echo "$f" ; done``
|
||||||
* Bash-it supports Bash 3.2 and higher. Please don't use features only available in Bash 4, such as associative arrays.
|
* Bash-it supports Bash 3.2 and higher. Please don't use features only available in Bash 4, such as associative arrays.
|
||||||
|
|
||||||
Unit Tests
|
Unit Tests
|
||||||
----------
|
----------
|
||||||
|
|
||||||
When adding features or making changes/fixes, please run our growing unit test suite to ensure that you did not break existing functionality.
|
When adding features or making changes/fixes, please run our growing unit test suite to ensure that you did not break existing functionality.
|
||||||
The test suite does not cover all aspects of Bash-it, but please run it anyway to verify that you did not introduce any regression issues.
|
The test suite does not cover all aspects of Bash-it, but please run it anyway to verify that you did not introduce any regression issues.
|
||||||
|
|
||||||
Any code pushed to GitHub as part of a Pull Request will automatically trigger a continuous integration build on `GitHub Actions <https://github.com/Bash-it/bash-it/actions>`_\ , where the test suite is run on both Linux and macOS.
|
Any code pushed to GitHub as part of a Pull Request will automatically trigger a continuous integration build on `GitHub Actions <https://github.com/Bash-it/bash-it/actions>`_\ , where the test suite is run on both Linux and macOS.
|
||||||
The Pull Request will then show the result of the CI build, indicating whether all tests ran fine, or whether there were issues.
|
The Pull Request will then show the result of the CI build, indicating whether all tests ran fine, or whether there were issues.
|
||||||
Please pay attention to this, Pull Requests with build issues will not be merged.
|
Please pay attention to this, Pull Requests with build issues will not be merged.
|
||||||
|
|
||||||
Adding new functionality or changing existing functionality is a good opportunity to increase Bash-it's test coverage.
|
Adding new functionality or changing existing functionality is a good opportunity to increase Bash-it's test coverage.
|
||||||
When you're changing the Bash-it codebase, please consider adding some unit tests that cover the new or changed functionality.
|
When you're changing the Bash-it codebase, please consider adding some unit tests that cover the new or changed functionality.
|
||||||
Ideally, when fixing a bug, a matching unit test that verifies that the bug is no longer present, is added at the same time.
|
Ideally, when fixing a bug, a matching unit test that verifies that the bug is no longer present, is added at the same time.
|
||||||
|
|
||||||
To run the test suite, simply execute the following in the directory where you cloned Bash-it:
|
To run the test suite, simply execute the following in the directory where you cloned Bash-it:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
test/run
|
test/run
|
||||||
|
|
||||||
This command will ensure that the `Bats Test Framework <https://github.com/bats-core/bats-core>`_ is available in the local ``test_lib`` directory (Bats is included as a Git submodule) and then run the test suite found in the `test <test>`_ folder.
|
This command will ensure that the `Bats Test Framework <https://github.com/bats-core/bats-core>`_ is available in the local ``test_lib`` directory (Bats is included as a Git submodule) and then run the test suite found in the `test <test>`_ folder.
|
||||||
The test script will execute each test in turn, and will print a status for each test case.
|
The test script will execute each test in turn, and will print a status for each test case.
|
||||||
|
|
||||||
When adding new test cases, please take a look at the existing test cases for examples.
|
When adding new test cases, please take a look at the existing test cases for examples.
|
||||||
|
|
||||||
The following libraries are used to help with the tests:
|
The following libraries are used to help with the tests:
|
||||||
|
|
||||||
|
|
||||||
* Test Framework: https://github.com/bats-core/bats-core
|
* Test Framework: https://github.com/bats-core/bats-core
|
||||||
* Support library for Bats-Assert: https://github.com/ztombol/bats-support
|
* Support library for Bats-Assert: https://github.com/ztombol/bats-support
|
||||||
* General ``assert`` functions: https://github.com/ztombol/bats-assert
|
* General ``assert`` functions: https://github.com/ztombol/bats-assert
|
||||||
* File ``assert`` functions: https://github.com/ztombol/bats-file
|
* File ``assert`` functions: https://github.com/ztombol/bats-file
|
||||||
|
|
||||||
When verifying test results, please try to use the ``assert`` functions found in these libraries.
|
When verifying test results, please try to use the ``assert`` functions found in these libraries.
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|
||||||
* When adding new completions or plugins, please don't simply copy existing tools into the Bash-it codebase, try to load/integrate the tools instead.
|
* When adding new completions or plugins, please don't simply copy existing tools into the Bash-it codebase, try to load/integrate the tools instead.
|
||||||
An example is using ``nvm``\ : Instead of copying the existing ``nvm`` script into Bash-it, the ``nvm.plugin.bash`` file tries to load an existing installation of ``nvm``.
|
An example is using ``nvm``\ : Instead of copying the existing ``nvm`` script into Bash-it, the ``nvm.plugin.bash`` file tries to load an existing installation of ``nvm``.
|
||||||
This means an additional step for the user (installing ``nvm`` from its own repo, or through a package manager),
|
This means an additional step for the user (installing ``nvm`` from its own repo, or through a package manager),
|
||||||
but it will also ensure that ``nvm`` can be upgraded in an easy way.
|
but it will also ensure that ``nvm`` can be upgraded in an easy way.
|
||||||
|
|
||||||
.. _contributing_theme:
|
.. _contributing_theme:
|
||||||
|
|
||||||
Themes
|
Themes
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|
||||||
* When adding a new theme, please include a screenshot and a short description about what makes this theme unique in the Pull Request's description field.
|
* When adding a new theme, please include a screenshot and a short description about what makes this theme unique in the Pull Request's description field.
|
||||||
Please do not add theme screenshots to the main PR itself, as they will add unnecessary bloat to the main branch in the repo.
|
Please do not add theme screenshots to the main PR itself, as they will add unnecessary bloat to the main branch in the repo.
|
||||||
The project's docs has a `Themes page <https://github.com/Bash-it/bash-it/blob/master/docs/themes-list/index.rst>`_ where you should add a screenshot, see how :ref:`here<add_screenshot>`.
|
The project's docs has a `Themes page <https://github.com/Bash-it/bash-it/blob/master/docs/themes-list/index.rst>`_ where you should add a screenshot, see how :ref:`here<add_screenshot>`.
|
||||||
* Ideally, you should add a ``<theme_name>.rst`` file describing the theme and its configuration options to ``docs/themes-list`` folder.
|
* Ideally, you should add a ``<theme_name>.rst`` file describing the theme and its configuration options to ``docs/themes-list`` folder.
|
||||||
|
|
||||||
.. _add_screenshot:
|
.. _add_screenshot:
|
||||||
|
|
||||||
Adding a Screenshot
|
Adding a Screenshot
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
In order to add a new screenshot, use the ``gh-pages`` branch.
|
In order to add a new screenshot, use the ``gh-pages`` branch.
|
||||||
Add your new screenshot to the ``docs/images`` folder, and open a PR.
|
Add your new screenshot to the ``docs/images`` folder, and open a PR.
|
||||||
In the `Themes page <https://github.com/Bash-it/bash-it/blob/master/docs/themes-list/index.rst>`_, see the other screenshots to know what kind of link you should use.
|
In the `Themes page <https://github.com/Bash-it/bash-it/blob/master/docs/themes-list/index.rst>`_, see the other screenshots to know what kind of link you should use.
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue