Skip to content

Commit

Permalink
cheatsheet.sh: Make CWD independent
Browse files Browse the repository at this point in the history
[why]
Sometimes people like to call the scripts from any directory and do not
want to change into the bin/scripts/ directory first.

[how]
Just access the lib files relative to the cheatsheet script file.

Signed-off-by: Fini Jastrow <[email protected]>
  • Loading branch information
Finii committed Aug 28, 2024
1 parent e6bba1b commit d294607
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/scripts/cheatsheet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
# Search for a glyph by part of its name in all patchsets
# Usage: ./cheatsheet.sh divider

# Get script directory to set source and target dirs relative to it
sd="$( cd -- "$(dirname "${0}")" >/dev/null 2>&1 || exit ; pwd -P )"

# shellcheck disable=SC1091 # Do not pull in the sourced file
source ./lib/i_all.sh
source "${sd}/lib/i_all.sh"

# Search the key on the declared variables
for glyph in ${!i_*}; do
Expand Down

0 comments on commit d294607

Please sign in to comment.