Skip to content

Commit

Permalink
realpath func that works on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
carderne committed Jul 27, 2022
1 parent 430054f commit 2b9ea75
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion helper.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# This is a utility function to make running the Docker image easier
#
# Source it as follows:
# source helper.sh
#
# And then use it as follows:
# signalexport ~/Downloads/signal-chats/

realpath_local() {
# From https://stackoverflow.com/a/3572105
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}

signalexport () {
if [[ -z "$1" ]]; then
echo 'Must provide output path as first parameters'
Expand All @@ -12,7 +24,7 @@ signalexport () {
input="$HOME/AppData/Roaming/Signal/"
fi

output=$(realpath $1)
output=$(realpath_local $1)
shift 1
docker run --rm -it --name signal-export \
-v "$input:/Signal" \
Expand Down

0 comments on commit 2b9ea75

Please sign in to comment.