Delete .shellcheckrc (#1947)
* CI: disable Ubuntu 16.04 as it's EOL https://github.blog/changelog/2021-04-29-github-actions-ubuntu-16-04-lts-virtual-environment-will-be-removed-on-september-20-2021/ * main: lint false positive * install: lint * plugins/cmd-returned-notify: don't `export` * plugins/xterm: lint * plugins/git: lint * plugins/goenv: lint * plugins/alias-completion: lint false positives * plugins/alias-completion: fix SC2155, SC2154 Declare `locals` at the top of the function * completion: lint completions using `bash_completion` functions Match the style of the existing code * completion/knife: lint false positives * completion/knife: lint * completion/sdkman: lint * completion/composer: lint * Move `.shellcheckrc` under `themes/` * lib/theme: fix SC2155, SC2154, SC2034 * lib/colors: don't warn on unused variables We assign a large number of variables here and they may or may not be used anywhere else, so disable SC2034 for this file (only). Alsö disable SC2005 as the functions in this file were written before `printf` was invented and have to do some fancy metascripting to get escape sequences interpreted reliably. I’m not smart enough to fix this to use `printf`, so leave it for now. * themes/agnoster: lint * themes: disable SC2154 for colors Each one of these themes will need it’s own fix for SC2154, possibly upstream. Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules. * themes: disable SC2154, fix SC2155 Each one of these themes will need it’s own fix for SC2154, possibly upstream. Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules. * Delete `.shellcheckrc` * remove executable bit
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||
SCM_THEME_PROMPT_PREFIX=" |"
|
||||
@@ -11,7 +14,7 @@ GIT_THEME_PROMPT_SUFFIX="${green}|"
|
||||
|
||||
# Nicely formatted terminal prompt
|
||||
function prompt_command() {
|
||||
export PS1="\n${bold_black}[${blue}\@${bold_black}]-${bold_black}[${green}\u${yellow}@${green}\h${bold_black}]-${bold_black}[${purple}\w${bold_black}]-$(scm_prompt_info)\n${reset_color}\$ "
|
||||
PS1="\n${bold_black}[${blue}\@${bold_black}]-${bold_black}[${green}\u${yellow}@${green}\h${bold_black}]-${bold_black}[${purple}\w${bold_black}]-$(scm_prompt_info)\n${reset_color}\$ "
|
||||
}
|
||||
|
||||
safe_append_prompt_command prompt_command
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# vim: ft=bash ts=2 sw=2 sts=2
|
||||
#
|
||||
# agnoster's Theme - https://gist.github.com/3712874
|
||||
@@ -220,7 +221,7 @@ prompt_virtualenv() {
|
||||
|
||||
# Context: user@hostname (who am I and where am I)
|
||||
prompt_context() {
|
||||
local user=$(whoami)
|
||||
local user="${USER:-${LOGNAME:?}}"
|
||||
|
||||
if [[ $user != "$DEFAULT_USER" || -n $SSH_CLIENT ]]; then
|
||||
prompt_segment black default "$user@\h"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
# Atomic Bash Prompt for Bash-it
|
||||
# By lfelipe base on the theme brainy of MunifTanjim
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
# Theme custom glyphs
|
||||
SCM_GIT_CHAR_GITLAB=${BARBUK_GITLAB_CHAR:=' '}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
|
||||
CLOCK_CHAR_THEME_PROMPT_PREFIX=''
|
||||
CLOCK_CHAR_THEME_PROMPT_SUFFIX=''
|
||||
@@ -130,12 +131,11 @@ function scm {
|
||||
}
|
||||
|
||||
scm_prompt() {
|
||||
local CHAR=$(scm_char)
|
||||
local CHAR
|
||||
CHAR="$(scm_char)"
|
||||
local format=${SCM_PROMPT_FORMAT:-'[%s%s]'}
|
||||
|
||||
if [[ $CHAR = "$SCM_NONE_CHAR" ]]; then
|
||||
return
|
||||
else
|
||||
if [[ "${CHAR}" != "$SCM_NONE_CHAR" ]]; then
|
||||
# shellcheck disable=2059
|
||||
printf "$format\n" "$CHAR" "$(scm_prompt_info)"
|
||||
fi
|
||||
@@ -352,15 +352,15 @@ function svn_prompt_vars {
|
||||
# - .hg is located in ~/Projects/Foo/.hg
|
||||
# - get_hg_root starts at ~/Projects/Foo/Bar and sees that there is no .hg directory, so then it goes into ~/Projects/Foo
|
||||
function get_hg_root {
|
||||
local CURRENT_DIR=$(pwd)
|
||||
local CURRENT_DIR="${PWD}"
|
||||
|
||||
while [ "$CURRENT_DIR" != "/" ]; do
|
||||
if [ -d "$CURRENT_DIR/.hg" ]; then
|
||||
while [[ "${CURRENT_DIR:-/}" != "/" ]]; do
|
||||
if [[ -d "$CURRENT_DIR/.hg" ]]; then
|
||||
echo "$CURRENT_DIR/.hg"
|
||||
return
|
||||
fi
|
||||
|
||||
CURRENT_DIR=$(dirname "$CURRENT_DIR")
|
||||
CURRENT_DIR="${CURRENT_DIR%/*}"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ function prompt_char {
|
||||
|
||||
function battery_char {
|
||||
if [[ "${THEME_BATTERY_PERCENTAGE_CHECK}" = true ]]; then
|
||||
echo -e "${bold_red}$(battery_percentage)%"
|
||||
echo -e "${bold_red:-}$(battery_percentage)%"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ function __check_precmd_conflict() {
|
||||
function safe_append_prompt_command {
|
||||
local prompt_re
|
||||
|
||||
if [ "${__bp_imported}" == "defined" ]; then
|
||||
if [ "${__bp_imported:-missing}" == "defined" ]; then
|
||||
# We are using bash-preexec
|
||||
if ! __check_precmd_conflict "${1}"; then
|
||||
precmd_functions+=("${1}")
|
||||
@@ -609,7 +609,7 @@ function safe_append_prompt_command {
|
||||
prompt_re="\<${1}\>"
|
||||
fi
|
||||
|
||||
if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then
|
||||
if [[ ${PROMPT_COMMAND[*]:-} =~ ${prompt_re} ]]; then
|
||||
return
|
||||
elif [[ -z ${PROMPT_COMMAND} ]]; then
|
||||
PROMPT_COMMAND="${1}"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
# Detect whether a reboot is required
|
||||
function show_reboot_required() {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_PREFIX=" ${yellow}‹"
|
||||
SCM_THEME_PROMPT_SUFFIX="›${reset_color}"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
# Brainy Bash Prompt for Bash-it
|
||||
# by MunifTanjim
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_PREFIX=""
|
||||
SCM_THEME_PROMPT_SUFFIX=""
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
function prompt_command() {
|
||||
PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue} →${bold_blue} ${reset_color} ${normal}"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2005
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
function __ {
|
||||
echo "$@"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_PREFIX="${bold_green}[ ${normal}"
|
||||
SCM_THEME_PROMPT_SUFFIX="${bold_green} ] "
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_PREFIX=""
|
||||
SCM_THEME_PROMPT_SUFFIX=""
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
# Define this here so it can be used by all of the Powerline themes
|
||||
THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true}
|
||||
|
||||
@@ -139,7 +142,7 @@ function __powerline_scm_prompt() {
|
||||
}
|
||||
|
||||
function __powerline_cwd_prompt() {
|
||||
local cwd=$(pwd | sed "s|^${HOME}|~|")
|
||||
local cwd="${PWD/$HOME/\~}"
|
||||
|
||||
echo "${cwd}|${CWD_THEME_PROMPT_COLOR}"
|
||||
}
|
||||
@@ -157,10 +160,10 @@ function __powerline_clock_prompt() {
|
||||
}
|
||||
|
||||
function __powerline_battery_prompt() {
|
||||
local color=""
|
||||
local battery_status="$(battery_percentage 2> /dev/null)"
|
||||
local color="" battery_status
|
||||
battery_status="$(battery_percentage 2> /dev/null)"
|
||||
|
||||
if [[ -z "${battery_status}" ]] || [[ "${battery_status}" = "-1" ]] || [[ "${battery_status}" = "no" ]]; then
|
||||
if [[ -z "${battery_status}" || "${battery_status}" == "-1" || "${battery_status}" == "no" ]]; then
|
||||
true
|
||||
else
|
||||
if [[ "$((10#${battery_status}))" -le 5 ]]; then
|
||||
@@ -176,7 +179,7 @@ function __powerline_battery_prompt() {
|
||||
}
|
||||
|
||||
function __powerline_in_vim_prompt() {
|
||||
if [ -n "$VIMRUNTIME" ]; then
|
||||
if [[ -n "$VIMRUNTIME" ]]; then
|
||||
echo "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}"
|
||||
fi
|
||||
}
|
||||
@@ -221,7 +224,8 @@ function __powerline_command_number_prompt() {
|
||||
}
|
||||
|
||||
function __powerline_duration_prompt() {
|
||||
local duration=$(_command_duration)
|
||||
local duration
|
||||
duration=$(_command_duration)
|
||||
[[ -n "$duration" ]] && echo "${duration}|${COMMAND_DURATION_PROMPT_COLOR}"
|
||||
}
|
||||
|
||||
@@ -265,7 +269,7 @@ function __powerline_last_status_prompt() {
|
||||
|
||||
function __powerline_prompt_command() {
|
||||
local last_status="$?" ## always the first
|
||||
local separator_char="${POWERLINE_PROMPT_CHAR}"
|
||||
local separator_char="${POWERLINE_PROMPT_CHAR}" info prompt_color
|
||||
|
||||
LEFT_PROMPT=""
|
||||
SEGMENTS_AT_LEFT=0
|
||||
@@ -277,7 +281,7 @@ function __powerline_prompt_command() {
|
||||
|
||||
## left prompt ##
|
||||
for segment in $POWERLINE_PROMPT; do
|
||||
local info="$(__powerline_"${segment}"_prompt)"
|
||||
info="$(__powerline_"${segment}"_prompt)"
|
||||
[[ -n "${info}" ]] && __powerline_left_segment "${info}"
|
||||
done
|
||||
|
||||
@@ -289,7 +293,7 @@ function __powerline_prompt_command() {
|
||||
|
||||
# By default we try to match the prompt to the adjacent segment's background color,
|
||||
# but when part of the prompt exists within that segment, we instead match the foreground color.
|
||||
local prompt_color="$(set_color "${LAST_SEGMENT_COLOR}" -)"
|
||||
prompt_color="$(set_color "${LAST_SEGMENT_COLOR}" -)"
|
||||
if [[ -n "${LEFT_PROMPT}" ]] && [[ -n "${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}" ]]; then
|
||||
LEFT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR}")${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}"
|
||||
prompt_color="${normal}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
|
||||
# shellcheck source=../../themes/powerline/powerline.base.bash
|
||||
. "$BASH_IT/themes/powerline/powerline.base.bash"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
# scm theming
|
||||
SCM_THEME_PROMPT_PREFIX="|"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034 # Expected behavior for themes.
|
||||
# shellcheck disable=SC2154 #TODO: fix these all.
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${bold_red}⊘${normal}"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}"
|
||||
@@ -26,8 +28,8 @@ venv_prompt() {
|
||||
}
|
||||
|
||||
function prompt_command() {
|
||||
retval=$?
|
||||
local ret_status="$([ $retval -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")"
|
||||
local retval=$? ret_status
|
||||
ret_status="$([ $retval -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")"
|
||||
PS1="\n${PURITY_THEME_PROMPT_COLOR}\w $(scm_prompt_info)\n${ret_status}$(venv_prompt)"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user