--size: Handle px suffix

This commit is contained in:
Dylan 2016-02-24 12:19:55 +11:00
parent 53379563db
commit 2b9167e889
4 changed files with 8 additions and 4 deletions

3
1.3.md
View file

@ -16,6 +16,9 @@ is now calculated by fetch automatically.
```sh
# Image takes up 70% of the terminal size.
fetch --size 70%
# Size the image in pixels.
fetch --size 200px
```
### Packages

View file

@ -273,7 +273,7 @@ alias fetch2="fetch \
--image type Image source. Where and what image we display.
Possible values: wall, shuffle, ascii,
/path/to/img, off
--size 20 | --size 20% Size to make the image, takes pixels or a percentage.
--size 20px | --size 20% Size to make the image, takes pixels or a percentage.
--image_backend w3m/iterm2 Which program to use to draw images.
--shuffle_dir path/to/dir Which directory to shuffle for an image.
--image_position left/right Where to display the image: (Left/Right)

View file

@ -255,7 +255,7 @@ crop_offset="center"
# Image size
# The image is half the terminal width by default.
# --size auto, px, 00%
# --size auto, 00px, 00%
image_size="auto"
# Right gap between image and text

5
fetch
View file

@ -275,7 +275,7 @@ crop_offset="center"
# Image size
# The image is half the terminal width by default.
# --size auto, px, 00%
# --size auto, 00px, 00%
image_size="auto"
# Right gap between image and text
@ -1739,6 +1739,7 @@ getimage () {
image_size=$((percent * term_height / 100))
;;
esac
image_size=${image_size/px}
# Where to draw the image
case "$image_position" in
@ -2266,7 +2267,7 @@ usage () { cat << EOF
--image type Image source. Where and what image we display.
Possible values: wall, shuffle, ascii,
/path/to/img, off
--size 20 | --size 20% Size to make the image, takes pixels or a percentage.
--size 20px | --size 20% Size to make the image, takes pixels or a percentage.
--image_backend w3m/iterm2 Which program to use to draw images.
--shuffle_dir path/to/dir Which directory to shuffle for an image.
--image_position left/right Where to display the image: (Left/Right)