Compare commits

...

31 commits

Author SHA1 Message Date
BBaoVanC
5762eafd73
Revert "Add nekos submodule"
This reverts commit 5cadb17f82.

I removed the repo, see
https://github.com/proprdev/nekofetch/issues/10#issuecomment-907532827
2021-08-27 19:09:35 -05:00
BBaoVanC
5cadb17f82
Add nekos submodule
Closes #10

See the Makefile in the submodule for installation -- Procursus package
coming soon.
2021-05-22 13:59:38 -05:00
BBaoVanC
ad0c343470
Add support for offline images 2021-05-22 13:12:01 -05:00
BBaoVanC
11c808f7fd
Merge pull request #13 from proprdev/actions-improvements
Use matrix in integraton.yml
2021-05-21 15:31:02 -05:00
BBaoVanC
4ebbf1a123
Use matrix in integraton.yml 2021-04-29 17:44:40 -05:00
BBaoVanC
408dad816f
Add some extra whitespace 2021-04-29 17:16:53 -05:00
BBaoVanC
dd64a4d58e
Use command-line flags for debug mode (instead of environment variable) 2021-04-29 17:11:49 -05:00
BBaoVanC
f05516b850
Remove unnecessary null definitions 2021-04-29 17:05:20 -05:00
BBaoVanC
be00f74518
Use -n instead of ! -z 2021-04-29 16:51:30 -05:00
BBaoVanC
1dd055787f
Use $use_height correctly in debug message 2021-04-29 16:49:49 -05:00
BBaoVanC
edfc35ce34
Use -z instead of checking if equal to "" 2021-04-29 16:48:23 -05:00
BBaoVanC
baac624468
Show the url of the image used when debug is enabled 2021-04-03 23:59:21 -05:00
BBaoVanC
f40b17ca06
Use an if statement for kitty imagemagick check 2021-03-29 21:18:33 -05:00
BBaoVanC
5c3c590825
Prevent error code 1 when not warning for kitty's imagemagick dependency 2021-03-29 21:14:29 -05:00
BBaoVanC
e1e499f1dd
Merge pull request #9 from AryToNeX/master
Proper arguments support and support w3m backend
2021-03-29 20:58:02 -05:00
Naomi Calabretta
f461cbb3a2 Warn if an argument is passed more than once
also respect the first passed argument of its kind only
2021-03-29 12:56:08 +02:00
Naomi Calabretta
57a29f12b4 Proper arguments support and support w3m backend 2021-03-29 00:52:33 +02:00
BBaoVanC
9382314f82
Merge pull request #8 from brennanleblanc0/master
Allow specifying a DESTDIR
2021-03-23 20:41:37 -05:00
Brennan LeBlanc
83664a30a0
Allow specifying a DESTDIR 2021-03-23 12:35:42 -03:00
BBaoVanC
de10710c32
Merge pull request #7 from NotZoeyDev/master
Add iTerm2 support
2021-03-14 18:00:54 -05:00
Zoey
4f9abc859a Add iTerm2 support 2021-03-14 18:42:35 -04:00
BBaoVanC
355a216f1e
Use the default name on mktemp (so it goes to a temporary directory) 2021-02-28 13:30:35 -06:00
propruhh
7ff9cf1d59
Make debug messages oneline 2021-02-28 13:22:55 -06:00
propruhh
9fe6aca8c2 make DEBUG an environment variable 2021-02-28 13:09:27 -06:00
propruhh
df18da99e3 make posix compliant 2021-02-28 13:04:46 -06:00
propruhh
f679e105a3 Merge branch 'master' of https://github.com/proprdev/nekofetch 2021-02-28 11:08:20 -06:00
propruhh
6133e79de9 remove echo to tell you height/sfw/nsfw 2021-02-28 11:08:10 -06:00
BBaoVanC
9ed99828f8
Add warning message for kitty image backend for missing imagemagick 2021-02-25 19:07:55 -06:00
BBaoVanC
122bfa73f7
Mark imagemagick as optional dependency (allows kitty backend) 2021-02-25 19:02:12 -06:00
propruhh
380389c254 Fix BSD/MacOS mktemp illegal option error (would just do normal neofetch) 2021-02-25 18:55:00 -06:00
BBaoVanC
ec1c7e6b5e
Add debroots and controls targets to Makefile 2021-02-25 18:36:09 -06:00
4 changed files with 154 additions and 49 deletions

View file

@ -15,20 +15,20 @@ jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- iphoneos-arm
steps:
- uses: actions/checkout@v2
- name: Build debs
run: make debs
- name: Build deb
run: make ${{ matrix.arch }}deb
- name: Upload iphoneos-arm deb as artifact
- name: Upload deb as artifact
uses: actions/upload-artifact@v2
with:
name: iphoneos-arm-deb
path: com.propr.nekofetch*iphoneos-arm.deb
- name: Upload amd64 deb as artifact
uses: actions/upload-artifact@v2
with:
name: amd64-deb
path: nekofetch*amd64.deb
name: ${{ matrix.arch }}-deb
path: "*nekofetch*.deb"

View file

@ -7,37 +7,42 @@ PREFIX ?= /usr
all:
@echo "Nekofetch doesn't need to be compiled, run 'make install' to install"
debs: options iosdeb amd64deb
debs: options iphoneos-armdeb amd64deb
debroots: options iphoneos-armdebroot amd64debroot
controls: options iphoneos-armcontrol amd64control
options:
@echo "VERSION: $(VERSION)"
install:
mkdir -p $(PREFIX)/bin
install -m 0755 nekofetch $(PREFIX)/bin/nekofetch
mkdir -p $(DESTDIR)$(PREFIX)/bin
install -m 0755 nekofetch $(DESTDIR)$(PREFIX)/bin/nekofetch
@echo "You may need to install jq, jp2a, and neofetch"
@echo "imagemagick is also required to use the kitty image backend"
uninstall:
rm -f $(PREFIX)/bin/nekofetch
rm -f $(DESTDIR)$(PREFIX)/bin/nekofetch
ioscontrol:
cp control.template ioscontrol
sed -i 's/PACKAGE/com.propr.nekofetch/' ioscontrol
sed -i 's/ARCH/iphoneos-arm/' ioscontrol
sed -i 's/VERSION/$(VERSION)/' ioscontrol
iphoneos-armcontrol:
cp control.template iphoneos-armcontrol
sed -i 's/PACKAGE/com.propr.nekofetch/' iphoneos-armcontrol
sed -i 's/ARCH/iphoneos-arm/' iphoneos-armcontrol
sed -i 's/VERSION/$(VERSION)/' iphoneos-armcontrol
amd64control:
cp control.template amd64control
sed -i 's/PACKAGE/nekofetch/' amd64control
sed -i 's/ARCH/amd64/' amd64control
sed -i 's/VERSION/$(VERSION)/' amd64control
iosdebroot: ioscontrol
mkdir -p iosdebroot/DEBIAN
mkdir -p iosdebroot/usr/bin
mkdir -p iosdebroot/usr/share/doc/nekofetch
cp ioscontrol iosdebroot/DEBIAN/control
cp LICENSE iosdebroot/usr/share/doc/nekofetch/copyright
cp nekofetch iosdebroot/usr/bin/nekofetch
iphoneos-armdebroot: iphoneos-armcontrol
mkdir -p iphoneos-armdebroot/DEBIAN
mkdir -p iphoneos-armdebroot/usr/bin
mkdir -p iphoneos-armdebroot/usr/share/doc/nekofetch
cp iphoneos-armcontrol iphoneos-armdebroot/DEBIAN/control
cp LICENSE iphoneos-armdebroot/usr/share/doc/nekofetch/copyright
cp nekofetch iphoneos-armdebroot/usr/bin/nekofetch
amd64debroot: amd64control
mkdir -p amd64debroot/DEBIAN
mkdir -p amd64debroot/usr/bin
@ -46,14 +51,14 @@ amd64debroot: amd64control
cp LICENSE amd64debroot/usr/share/doc/nekofetch/copyright
cp nekofetch amd64debroot/usr/bin/nekofetch
iosdeb: iosdebroot
dpkg-deb -b "iosdebroot" "com.propr.nekofetch_$(VERSION)_iphoneos-arm.deb"
iphoneos-armdeb: iphoneos-armdebroot
dpkg-deb -b "iphoneos-armdebroot" "com.propr.nekofetch_$(VERSION)_iphoneos-arm.deb"
amd64deb: amd64debroot
dpkg-deb -b "amd64debroot" "nekofetch_$(VERSION)_amd64.deb"
clean:
rm -rf iosdebroot amd64debroot
rm -f ioscontrol amd64control
rm -rf iphoneos-armdebroot amd64debroot
rm -f iphoneos-armcontrol amd64control
rm -f com.propr.nekofetch_*_iphoneos-arm.deb nekofetch_*_amd64.deb
.PHONY: all debs options install uninstall clean iosdeb amd64deb
.PHONY: all debs debroots controls options install uninstall iphoneos-armdeb amd64deb clean

View file

@ -2,5 +2,6 @@ Package: PACKAGE
Architecture: ARCH
Version: VERSION
Depends: curl, jq, jp2a, neofetch
Recommends: imagemagick
Description: neofetch but with nekos
Maintainer: bbaovanc <bbaovanc@bbaovanc.com>

135
nekofetch
View file

@ -1,33 +1,132 @@
#!/bin/sh
tmpfile="$(mktemp -p /tmp nekofetchXXXXXXXX)"
tmpfile="$(mktemp)"
case "$1" in
"--nsfw"|"nsfw"|"-n"|"n")
echo "Getting a nsfw image"
while :; do
case "$1" in
"--verbose"|"--debug"|"-v")
if [ -z "$debug" ]; then
[ "$debug" = "true" ] && echo "Enabling debug output"
debug="true"
else
echo "debug has already been enabled!"
fi
;;
"--offline"|"-o")
if [ -z "$offline" ]; then
[ "$debug" = "true" ] && echo "Enabling offline mode"
offline="true"
else
echo "offline has already been enabled!"
fi
;;
"--nekodir")
if [ -z "$nekodir" ]; then
nekodir="$2"
offline="true"
[ "$debug" = "true" ] && echo "Using offline dir $nekodir"
else
echo "You can only specify the neko dir argument once!"
fi
shift
;;
"--nsfw"|"nsfw"|"-n"|"n")
if [ -z "$imgtype" ]; then
[ "$debug" = "true" ] && echo "Getting a nsfw image"
imgtype="nsfw"
else
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
fi
;;
"--sfw"|"sfw"|"-s"|"s")
if [ -z "$imgtype" ]; then
[ "$debug" = "true" ] && echo "Getting a sfw image"
imgtype="sfw"
else
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
fi
;;
"--w3m"|"w3m"|"--img"|"img"|"-i"|"i")
[ "$debug" = "true" ] && echo "Using w3m image backend for neofetch"
use_w3m="true"
;;
"--height"|"-h")
if [ -z "$use_height" ]; then
use_height="$2"
[ "$debug" = "true" ] && echo "Using height $use_height"
else
echo "You can only specify the height argument once!"
fi
shift
;;
*)
if [ -z "$1" ]; then
break
fi
echo "Could not interpret parameter '$1'."
;;
esac
shift
done
offlineloc="${nekodir:-/usr/share/nekofetch/nekos}"
if [ "$offline" = "true" ]; then
if [ ! -d "$offlineloc" ]; then
echo "The specified offline images location ($offlineloc) does not exist or is not a directory!"
exit 1
fi
fi
[ "$debug" = "true" ] && [ "$offline" = "true" ] && echo "The offline images location is $offlineloc"
if [ ! "$offline" = "true" ]; then
if [ "$imgtype" = "nsfw" ]; then
imgurl="https://nekos.life/api/v2/img/cum_jpg"
;;
"--sfw"|"sfw"|"-s"|"s")
echo "Getting a sfw image"
else
imgurl="https://nekos.life/api/v2/img/neko"
;;
*)
echo "Could not interpret as either sfw or nsfw. Defaulting to sfw."
imgurl="https://nekos.life/api/v2/img/neko"
;;
esac
fi
fi
echo "$2" | grep -qE '^[0-9]+$' && height="$2" || height="$(($(stty size | awk '{print $1}') - 5))"
echo "Using height $height"
if [ -n "$use_height" ]; then
height="$use_height"
else
height="$(($(stty size | awk '{print $1}') - 5))"
fi
url=$(curl -fsSL "$imgurl" | jq -r ".url")
if [ "$offline" = "true" ]; then
pickdir="$offlineloc/$imgtype"
cp "$(find "$pickdir" -type f | shuf -n 1)" "$tmpfile.jpg"
else
url=$(curl -fsSL "$imgurl" | jq -r ".url")
[ "$debug" = "true" ] && echo "Using image at url $url"
curl -fsSLo "$tmpfile.jpg" "$url"
fi
curl -fsSLo "$tmpfile.jpg" "$url"
if [ "$TERM" = "xterm-kitty" ]; then
neofetch --kitty "$tmpfile.jpg"
command -v convert > /dev/null 2>&1 && neofetch --kitty "$tmpfile.jpg" || kitty_imagemagick_warn=true
if [ "$kitty_imagemagick_warn" = "true" ]; then
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
neofetch --source "$tmpfile"
fi
elif [ "$LC_TERMINAL" = "iTerm2" ]; then
neofetch --iterm2 "$tmpfile.jpg"
elif [ "$use_w3m" = "true" ]; then
neofetch --w3m "$tmpfile.jpg"
else
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
neofetch --source "$tmpfile"
fi
rm "$tmpfile" "$tmpfile.jpg"
if [ "$kitty_imagemagick_warn" = "true" ]; then
echo "WARN: imagemagick is required for kitty image backend"
fi