Skip to content

Commit 5fd2afe

Browse files
authored
Merge pull request #2266 from seefood/ira/lint-cleanup
2 parents 775044b + 9df0c64 commit 5fd2afe

File tree

9 files changed

+105
-97
lines changed

9 files changed

+105
-97
lines changed

aliases/available/git.aliases.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ alias ggup='git log --branches --not --remotes --no-walk --decorate --oneline' #
8383
alias gll='git log --graph --pretty=oneline --abbrev-commit'
8484
alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
8585
alias gwc='git whatchanged'
86-
alias ghist='git log --pretty=format:'\''%h %ad | %s%d [%an]'\'' --graph --date=short' # Use it to be fast and without color.
86+
alias ghist='git log --pretty=format:'\''%h %ad | %s%d [%an]'\'' --graph --date=short' # Use it to be fast and without color.
8787
alias gprogress='git log --pretty=format:'\''%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d'\'' --decorate --date=short' #Usually use "git progress" in the file .gitconfig. The new alias from Git friends will be truly welcome.
8888

8989
# ls-files
@@ -153,8 +153,8 @@ alias grma='GIT_SEQUENCE_EDITOR=: git rebase $(get_default_branch) -i --autosqu
153153
alias gprom='git fetch origin $(get_default_branch) && git rebase origin/$(get_default_branch) && git update-ref refs/heads/$(get_default_branch) origin/$(get_default_branch)' # Rebase with latest remote
154154

155155
# reset
156-
alias gus='git reset HEAD' # read as: 'git unstage'
157-
alias grh='git reset' # equivalent to: git reset HEAD
156+
alias gus='git reset HEAD' # read as: 'git unstage'
157+
alias grh='git reset' # equivalent to: git reset HEAD
158158
alias grh!='git reset --hard'
159159
alias gpristine='git reset --hard && git clean -dfx'
160160

clean_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ plugins/available/base.plugin.bash
9090
plugins/available/basher.plugin.bash
9191
plugins/available/battery.plugin.bash
9292
plugins/available/blesh.plugin.bash
93+
plugins/available/browser.plugin.bash
9394
plugins/available/cmd-returned-notify.plugin.bash
9495
plugins/available/colors.plugin.bash
9596
plugins/available/direnv.plugin.bash

docs/themes-list/inretio.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ In Python virtual environment:
2929
┌──[2024-03-20 12:07:32] 🐧 gytis 💻 gytis-legion 🐍 3.12.2 on [general] 📂 general
3030
> ls
3131
bin include lib lib64 pyvenv.cfg share
32-
Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
1+
# shellcheck shell=bash
12
# based on https://gist.github.com/318247
23

34
cite about-plugin
45
about-plugin 'render commandline output in your browser'
56

7+
# shellcheck disable=SC2120
68
function browser() {
7-
about 'pipe html to a browser'
8-
example '$ echo "<h1>hi mom!</h1>" | browser'
9-
example '$ ron -5 man/rip.5.ron | browser'
10-
group 'browser'
9+
about 'pipe html to a browser'
10+
example '$ echo "<h1>hi mom!</h1>" | browser'
11+
example '$ ron -5 man/rip.5.ron | browser'
12+
group 'browser'
1113

12-
if [ -t 0 ]; then
13-
if [ -n "$1" ]; then
14-
open $1
15-
else
16-
reference browser
17-
fi
14+
if [ -t 0 ]; then
15+
if [ -n "$1" ]; then
16+
open "$1"
17+
else
18+
reference browser
19+
fi
1820

19-
else
20-
f="/tmp/browser.$RANDOM.html"
21-
cat /dev/stdin > $f
22-
open $f
23-
fi
21+
else
22+
f="/tmp/browser.$RANDOM.html"
23+
cat /dev/stdin > $f
24+
open $f
25+
fi
2426
}
2527

26-
2728
function wmate() {
28-
about 'pipe hot spicy interwebs into textmate and cleanup!'
29-
example '$ wmate google.com'
30-
group 'browser'
31-
32-
if [ -t 0 ]; then
33-
if [ -n "$1" ]; then
34-
wget -qO- $1 | /usr/bin/mate
29+
about 'pipe hot spicy interwebs into textmate and cleanup!'
30+
example '$ wmate google.com'
31+
group 'browser'
3532

36-
TIDY=`/usr/bin/osascript << EOT
33+
if [ -t 0 ]; then
34+
if [ -n "$1" ]; then
35+
wget -qO- "$1" | /usr/bin/mate
36+
TIDY=$(
37+
/usr/bin/osascript << EOT
3738
tell application "TextMate"
3839
activate
3940
end tell
@@ -53,24 +54,26 @@ tell application "System Events"
5354
end tell
5455
end tell
5556
end tell
56-
EOT`
57+
EOT
58+
)
59+
export TIDY
5760

58-
else
59-
reference wmate
60-
fi
61-
fi
61+
else
62+
reference wmate
63+
fi
64+
fi
6265
}
6366

6467
function raw() {
65-
about 'write wget into a temp file and pump it into your browser'
66-
example '$ raw google.com'
67-
group 'browser'
68+
about 'write wget into a temp file and pump it into your browser'
69+
example '$ raw google.com'
70+
group 'browser'
6871

69-
if [ -t 0 ]; then
70-
if [ -n "$1" ]; then
71-
wget -qO- $1 | browser
72-
else
73-
reference raw
74-
fi
75-
fi
72+
if [ -t 0 ]; then
73+
if [ -n "$1" ]; then
74+
wget -qO- "$1" | browser
75+
else
76+
reference raw
77+
fi
78+
fi
7679
}

test/plugins/battery.plugin.bats

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ function setup_ioreg {
271271
percent="$1"
272272

273273
function ioreg {
274+
# shellcheck disable=SC2317
274275
printf "\"MaxCapacity\" = 100\n\"CurrentCapacity\" = %s" "${percent}"
275276
}
276277
}

test/plugins/cmd-returned-notify.plugin.bats

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ function local_setup_file() {
99
}
1010

1111
@test "plugins cmd-returned-notify: notify after elapsed time" {
12-
export NOTIFY_IF_COMMAND_RETURNS_AFTER=0
13-
export COMMAND_DURATION_START_SECONDS="$(_shell_duration_en)"
12+
NOTIFY_IF_COMMAND_RETURNS_AFTER=0
13+
COMMAND_DURATION_START_SECONDS="$(_shell_duration_en)"
14+
export COMMAND_DURATION_START_SECONDS NOTIFY_IF_COMMAND_RETURNS_AFTER
1415
sleep 1
1516
run precmd_return_notification
1617
assert_success
1718
assert_output $'\a'
1819
}
1920

2021
@test "plugins cmd-returned-notify: do not notify before elapsed time" {
21-
export NOTIFY_IF_COMMAND_RETURNS_AFTER=10
22-
export COMMAND_DURATION_START_SECONDS="$(_shell_duration_en)"
22+
NOTIFY_IF_COMMAND_RETURNS_AFTER=10
23+
COMMAND_DURATION_START_SECONDS="$(_shell_duration_en)"
24+
export COMMAND_DURATION_START_SECONDS NOTIFY_IF_COMMAND_RETURNS_AFTER
2325
sleep 1
2426
run precmd_return_notification
2527
assert_success

themes/base.theme.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ function node_version_prompt() {
416416
_log_debug "node: using version strategy '$NODE_VERSION_STRATEGY'"
417417

418418
if [ "$NODE_VERSION_STRATEGY" == "nvm" ]; then
419-
nvm_version_prompt
419+
nvm_version_prompt
420420
elif [ "$NODE_VERSION_STRATEGY" == "node" ]; then
421-
node_native_version_prompt
421+
node_native_version_prompt
422422
fi
423423
}
424424

themes/inretio/inretio.theme.bash

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ VIRTUALENV_THEME_PROMPT_SUFFIX=""
1616
# SCM prompts
1717
SCM_NONE_CHAR=""
1818
SCM_GIT_CHAR="[±] "
19-
SCM_GIT_BEHIND_CHAR="${red}${normal}"
20-
SCM_GIT_AHEAD_CHAR="${bold_green}${normal}"
19+
SCM_GIT_BEHIND_CHAR="${red?}${normal?}"
20+
SCM_GIT_AHEAD_CHAR="${bold_green?}${normal?}"
2121
SCM_GIT_UNTRACKED_CHAR=""
22-
SCM_GIT_UNSTAGED_CHAR="${bold_yellow}${normal}"
23-
SCM_GIT_STAGED_CHAR="${bold_green}+${normal}"
22+
SCM_GIT_UNSTAGED_CHAR="${bold_yellow?}${normal?}"
23+
SCM_GIT_STAGED_CHAR="${bold_green?}+${normal?}"
2424

2525
SCM_THEME_PROMPT_DIRTY=""
2626
SCM_THEME_PROMPT_CLEAN=""
2727
SCM_THEME_PROMPT_PREFIX=""
2828
SCM_THEME_PROMPT_SUFFIX=""
2929

3030
# Git status prompts
31-
GIT_THEME_PROMPT_DIRTY=" ${red}${normal}"
32-
GIT_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"
31+
GIT_THEME_PROMPT_DIRTY=" ${red?}${normal?}"
32+
GIT_THEME_PROMPT_CLEAN=" ${bold_green?}${normal?}"
3333
GIT_THEME_PROMPT_PREFIX=""
3434
GIT_THEME_PROMPT_SUFFIX=""
3535

@@ -48,32 +48,32 @@ icon_end="└> "
4848

4949
# Display virtual environment info
5050
function _virtualenv_prompt {
51-
VIRTUALENV_DETAILS=""
52-
VIRTUALENV_CHAR=""
53-
54-
# $VIRTUAL_ENV is set and is non-zero length
55-
if [[ -n "$VIRTUAL_ENV" ]]; then
56-
# Check if Python 3 exists
57-
if command -v python3 >/dev/null 2>&1; then
58-
VIRTUALENV_DETAILS="$($VIRTUAL_ENV/bin/python --version | sed 's,Python ,,') on [$(basename $VIRTUAL_ENV)]"
59-
VIRTUALENV_CHAR=" 🐍"
60-
else
61-
VIRTUALENV_DETAILS="[$(basename $VIRTUAL_ENV)]"
62-
VIRTUALENV_CHAR=""
63-
fi
64-
fi
65-
66-
echo "$VIRTUALENV_CHAR $VIRTUALENV_DETAILS"
51+
VIRTUALENV_DETAILS=""
52+
VIRTUALENV_CHAR=""
53+
54+
# $VIRTUAL_ENV is set and is non-zero length
55+
if [[ -n "$VIRTUAL_ENV" ]]; then
56+
# Check if Python 3 exists
57+
if command -v python3 > /dev/null 2>&1; then
58+
VIRTUALENV_DETAILS="$("$VIRTUAL_ENV/bin/python" --version | sed 's,Python ,,') on [$(basename "$VIRTUAL_ENV")]"
59+
VIRTUALENV_CHAR=" 🐍"
60+
else
61+
VIRTUALENV_DETAILS="[$(basename "$VIRTUAL_ENV")]"
62+
VIRTUALENV_CHAR=""
63+
fi
64+
fi
65+
66+
echo "$VIRTUALENV_CHAR $VIRTUALENV_DETAILS"
6767
}
6868

6969
# Rename tab
7070
function tabname {
71-
printf "\e]1;$1\a"
71+
printf "\e]1;%s\a" "$1"
7272
}
7373

7474
# Rename window
7575
function winname {
76-
printf "\e]2;$1\a"
76+
printf "\e]2;%s\a" "$1"
7777
}
7878

7979
_theme_clock() {
@@ -92,8 +92,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%Y-%m-%d %H:%M:%S"}
9292

9393
# Displays the current prompt
9494
function prompt_command() {
95-
PS1="\n${icon_start}$(_theme_clock)${icon_user}${bold_green}\u${normal}${icon_host}${bold_cyan}\h${normal}${green}$(_virtualenv_prompt)${normal}${icon_directory}${bold_purple}\W${normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} $(scm_prompt_info) \")${white}${normal}\n${icon_end}"
96-
PS2="${icon_end}"
95+
PS1="\n${icon_start}$(_theme_clock)${icon_user}${bold_green?}\u${normal}${icon_host}${bold_cyan?}\h${normal}${green?}$(_virtualenv_prompt)${normal}${icon_directory}${bold_purple?}\W${normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} $(scm_prompt_info) \")${white?}${normal}\n${icon_end}"
96+
PS2="${icon_end}"
9797
}
9898

9999
# Runs prompt (this bypasses bash_it $PROMPT setting)

themes/lambda/lambda.theme.bash

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1-
#!/bin/bash
1+
# shellcheck shell=bash
22
# shellcheck disable=SC1090,SC2034
33

44
function set_prompt {
5-
local user_color="\[\033[1;31m\]" # bold red for username
6-
local at_color="\[\033[1;37m\]" # bold white for @ symbol
7-
local host_color="\[\033[1;31m\]" # bold red for hostname
8-
local in_color="\[\033[1;37m\]" # bold white for "in"
9-
local dir_color="\[\033[1;35m\]" # bold purple for current working directory
10-
local git_color="\[\033[1;36m\]" # bold cyan for Git information
11-
local time_color="\[\033[1;32m\]" # bold green for time taken
12-
local reset_color="\[\033[0m\]" # reset color
13-
local prompt_symbol_color="\[\033[1;31m\]" # bold red for the prompt symbol
5+
local user_color="\[\033[1;31m\]" # bold red for username
6+
local at_color="\[\033[1;37m\]" # bold white for @ symbol
7+
local host_color="\[\033[1;31m\]" # bold red for hostname
8+
local in_color="\[\033[1;37m\]" # bold white for "in"
9+
local dir_color="\[\033[1;35m\]" # bold purple for current working directory
10+
local git_color="\[\033[1;36m\]" # bold cyan for Git information
11+
local time_color="\[\033[1;32m\]" # bold green for time taken
12+
local reset_color="\[\033[0m\]" # reset color
13+
local prompt_symbol_color="\[\033[1;31m\]" # bold red for the prompt symbol
1414

15-
local end_time=$(date +%s%3N) # current time in milliseconds
16-
local time_taken=$(( (end_time - start_time) )) # time in milliseconds
15+
local end_time time_taken
16+
end_time=$(date +%s%3N) # current time in milliseconds
17+
# shellcheck disable=SC2154
18+
time_taken=$((end_time - start_time)) # time in milliseconds
1719

18-
PS1="${user_color}╭─\\u" # username
19-
PS1+="${at_color}@${host_color}\\h" # @ symbol and hostname
20-
PS1+="${in_color} in" # "in" between hostname and current directory
21-
PS1+="${dir_color} \\w" # current working directory
20+
PS1="${user_color}╭─\\u" # username
21+
PS1+="${at_color}@${host_color}\\h" # @ symbol and hostname
22+
PS1+="${in_color} in" # "in" between hostname and current directory
23+
PS1+="${dir_color} \\w" # current working directory
2224

23-
# Git information (status symbol)
24-
PS1+=" ${git_color}$(__git_ps1 "[%s]")${reset_color}"
25+
# Git information (status symbol)
26+
PS1+=" ${git_color}$(__git_ps1 "[%s]")${reset_color}"
2527

26-
if [ $time_taken -gt 0 ]; then
27-
PS1+=" ${time_color}took ${time_taken}ms" # time taken in milliseconds
28-
fi
28+
if [ $time_taken -gt 0 ]; then
29+
PS1+=" ${time_color}took ${time_taken}ms" # time taken in milliseconds
30+
fi
2931

30-
PS1+="\n${prompt_symbol_color}╰─λ${reset_color} " # red color for the prompt symbol, reset color after
32+
PS1+="\n${prompt_symbol_color}╰─λ${reset_color} " # red color for the prompt symbol, reset color after
3133
}
3234

3335
PROMPT_COMMAND='start_time=$(date +%s%3N); set_prompt'

0 commit comments

Comments
 (0)