* Add hooks to check .sh and .bash headers * Adds hooks/ to clean_files.txtpull/1778/head
parent
3fce1ffe8d
commit
e932d8371f
|
|
@ -28,3 +28,17 @@ repos:
|
||||||
# - id: forbid-crlf
|
# - id: forbid-crlf
|
||||||
- id: remove-crlf
|
- id: remove-crlf
|
||||||
exclude: ".bat$"
|
exclude: ".bat$"
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: dot-sh
|
||||||
|
name: Check .sh files against bash-it requirements
|
||||||
|
entry: ./hooks/dot-sh.sh
|
||||||
|
language: system
|
||||||
|
files: "\\.sh$"
|
||||||
|
types: [file]
|
||||||
|
- id: dot-bash
|
||||||
|
name: Check .bash files against bash-it requirements
|
||||||
|
entry: ./hooks/dot-bash.sh
|
||||||
|
language: system
|
||||||
|
files: "\\.bash$"
|
||||||
|
types: [file]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
cite 'about-alias'
|
cite 'about-alias'
|
||||||
about-alias 'vim abbreviations'
|
about-alias 'vim abbreviations'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
# root directories
|
# root directories
|
||||||
#
|
#
|
||||||
docs
|
docs
|
||||||
|
hooks
|
||||||
|
|
||||||
# root files
|
# root files
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env 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
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
# Published originally as public domain code at https://github.com/wk8/knife-bash-autocomplete
|
# Published originally as public domain code at https://github.com/wk8/knife-bash-autocomplete
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "packer completion"
|
about-completion "packer completion"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env 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
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
# rustup (Rust toolchain installer) completion
|
# rustup (Rust toolchain installer) completion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
_sdkman_complete() {
|
_sdkman_complete() {
|
||||||
local CANDIDATES
|
local CANDIDATES
|
||||||
local CANDIDATE_VERSIONS
|
local CANDIDATE_VERSIONS
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
cite "about-completion"
|
cite "about-completion"
|
||||||
about-completion "vault completion"
|
about-completion "vault completion"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
exit_code=0
|
||||||
|
for file in "$@"; do
|
||||||
|
# Confirm file is not executable
|
||||||
|
#
|
||||||
|
if [[ -x "${file}" ]]; then
|
||||||
|
echo "Bash include file \`${file}\` should not be executable"
|
||||||
|
exit_code=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Confirm expected schellcheck header
|
||||||
|
#
|
||||||
|
LINE1="$(head -n 1 "${file}")"
|
||||||
|
if [[ "${LINE1}" != "# shellcheck shell=bash" ]]; then
|
||||||
|
echo "Bash include file \`${file}\` has bad/missing shellcheck header"
|
||||||
|
exit_code=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $exit_code
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
exit_code=0
|
||||||
|
for file in "$@"; do
|
||||||
|
# Confirm file is executable
|
||||||
|
#
|
||||||
|
if [[ ! -x "${file}" ]]; then
|
||||||
|
echo "Bash file \`${file}\` is not executable"
|
||||||
|
exit_code=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Confirm expected #! header
|
||||||
|
#
|
||||||
|
LINE1="$(head -n 1 "${file}")"
|
||||||
|
if [[ "${LINE1}" != "#!/usr/bin/env bash" ]]; then
|
||||||
|
echo "Bash file \`${file}\` has bad/missing #! header"
|
||||||
|
exit_code=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $exit_code
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'initializes basher, the shell package manager'
|
about-plugin 'initializes basher, the shell package manager'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||||
SCM_THEME_PROMPT_PREFIX=" |"
|
SCM_THEME_PROMPT_PREFIX=" |"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
# vim: ft=bash ts=2 sw=2 sts=2
|
# vim: ft=bash ts=2 sw=2 sts=2
|
||||||
#
|
#
|
||||||
# agnoster's Theme - https://gist.github.com/3712874
|
# agnoster's Theme - https://gist.github.com/3712874
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
# shellcheck disable=2034,2154
|
|
||||||
|
|
||||||
# Theme custom glyphs
|
# Theme custom glyphs
|
||||||
SCM_GIT_CHAR_GITLAB=${BARBUK_GITLAB_CHAR:=' '}
|
SCM_GIT_CHAR_GITLAB=${BARBUK_GITLAB_CHAR:=' '}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
# Define this here so it can be used by all of the Powerline themes
|
# Define this here so it can be used by all of the Powerline themes
|
||||||
THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true}
|
THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
# shellcheck source=../../themes/powerline/powerline.base.bash
|
# shellcheck source=../../themes/powerline/powerline.base.bash
|
||||||
. "$BASH_IT/themes/powerline/powerline.base.bash"
|
. "$BASH_IT/themes/powerline/powerline.base.bash"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue