Skip to content

Commit

Permalink
Merge pull request #52 from theohbrothers/fix/trim-trailing-of-given-…
Browse files Browse the repository at this point in the history
…path

Fix: Trim trailing `/` of given path
  • Loading branch information
leojonathanoh authored Oct 28, 2022
2 parents 7d18778 + 8d981b4 commit fc0d322
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ At present, gallery is kept as minimalistic as possible. But it might already be
![](doc/assets/gallery.gif)

```sh
# Generate a `index.htm` in every descendent folder of /path/to with image files, and opens them in firefox
cd /path/to
webize gallery . | xargs firefox
# Generate a `index.htm` for every descendent folder of /path/to with image files, and opens it in firefox
webize gallery /path/to/pictures | xargs firefox

# Or, open in default web browser on a mac
webize gallery . | xargs open
webize gallery /path/to/pictures | xargs open

# Cleanup once you are done
webize clean .
webize clean /path/to/pictures
```

Keyboard shortcuts:
Expand Down
6 changes: 2 additions & 4 deletions webize
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ if [ ! -d "$DIR" ]; then
echo "Directory does not exist: $DIR" 1>&2
exit 1
fi
if [ "$DIR" = '.' ]; then
DIR="$PWD"
fi
DIR=$( echo "$DIR" | sed 's@/$@@' ) # Trim trailing '/'

# Get directories with images
IMAGES_REGEX='(\.gif|\.jpe?g|\.png|\.svg|\.webp)$'
Expand Down Expand Up @@ -109,7 +107,7 @@ if [ -n "$GALLERY" ]; then
done
)
if [ -z "$IMAGES_CSV" ]; then
echo "Couldn't obtain images' metadata"
echo "No images found in: $DIR"
exit 1
fi
cat - > "$INDEX_HTM" <<'EOF'
Expand Down

0 comments on commit fc0d322

Please sign in to comment.