mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
chore(lib): remove use of eval
This commit is contained in:
@@ -363,7 +363,9 @@ finalize_and_go_to_session() {
|
||||
# /Users/jimeh/Projects
|
||||
#
|
||||
__expand_path() {
|
||||
echo $(eval echo "$@")
|
||||
local path="$1"
|
||||
path="${path/#\~/$HOME}"
|
||||
echo "$path"
|
||||
}
|
||||
|
||||
__get_first_window_index() {
|
||||
|
||||
@@ -19,6 +19,12 @@ assert '__expand_path "/path/to/file"' "/path/to/file"
|
||||
# When given a path containing spaces, it returns path correctly.
|
||||
assert '__expand_path "~/Path To/File"' "${HOME}/Path To/File"
|
||||
|
||||
# When given a relative path, it returns path as is.
|
||||
assert '__expand_path "foo/bar"' "foo/bar"
|
||||
|
||||
# When given a relative parent path, it returns path as is.
|
||||
assert '__expand_path "../foo/bar"' "../foo/bar"
|
||||
|
||||
# Tear down.
|
||||
HOME="$realHOME"
|
||||
unset realHOME
|
||||
|
||||
Reference in New Issue
Block a user