Skip to content

Commit 397b0c5

Browse files
committed
shellcheck
1 parent 83df07a commit 397b0c5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

content/posts/2024-07-03-better-git-shell-aliases.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ By now you can probably see where this is going - these kinds of complex inline
5858

5959
> _Code should live in a place where it's easy to evaluate, execute, and evolve, not in some config strings where you can't do any of those things_.
6060
>
61-
> \- me, having a shower thought
61+
> \- me, shower thoughts
6262
6363
## My solution
6464

@@ -120,8 +120,9 @@ is_function() {
120120
# This main function serves to call your custom subcommand
121121
# functions (eg: 'gitex_foo') in this same gitex file.
122122
gitex() {
123+
local subcmd
123124
if is_function "$1"; then
124-
local subcmd="$1"
125+
subcmd="$1"
125126
shift
126127
"gitex_${subcmd}" "$@"
127128
else
@@ -139,10 +140,11 @@ You can now add new subcommand functions to your `~/bin/gitex` script. Let's add
139140
```sh
140141
##? browse: Open web browser to git remote URL
141142
gitex_browse() {
142-
local url=$(
143-
git config remote.${1:-origin}.url |
143+
local url
144+
url="$(
145+
git config "remote.${1:-origin}.url" |
144146
sed -e 's|^.*@|https://|' -e 's|.git$||' -e 's|:|/|2'
145-
)
147+
)"
146148
git web--browse $url
147149
}
148150
```

0 commit comments

Comments
 (0)