mirror of
https://github.com/danbulant/nekofetch
synced 2026-06-24 17:11:49 +00:00
Compare commits
11 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5762eafd73 | ||
|
|
5cadb17f82 | ||
|
|
ad0c343470 | ||
|
|
11c808f7fd | ||
|
|
4ebbf1a123 | ||
|
|
408dad816f | ||
|
|
dd64a4d58e | ||
|
|
f05516b850 | ||
|
|
be00f74518 | ||
|
|
1dd055787f | ||
|
|
edfc35ce34 |
3 changed files with 96 additions and 47 deletions
20
.github/workflows/integration.yml
vendored
20
.github/workflows/integration.yml
vendored
|
|
@ -15,20 +15,20 @@ jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch:
|
||||||
|
- amd64
|
||||||
|
- iphoneos-arm
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Build debs
|
- name: Build deb
|
||||||
run: make debs
|
run: make ${{ matrix.arch }}deb
|
||||||
|
|
||||||
- name: Upload iphoneos-arm deb as artifact
|
- name: Upload deb as artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: iphoneos-arm-deb
|
name: ${{ matrix.arch }}-deb
|
||||||
path: com.propr.nekofetch*iphoneos-arm.deb
|
path: "*nekofetch*.deb"
|
||||||
- name: Upload amd64 deb as artifact
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: amd64-deb
|
|
||||||
path: nekofetch*amd64.deb
|
|
||||||
|
|
|
||||||
40
Makefile
40
Makefile
|
|
@ -7,11 +7,11 @@ PREFIX ?= /usr
|
||||||
all:
|
all:
|
||||||
@echo "Nekofetch doesn't need to be compiled, run 'make install' to install"
|
@echo "Nekofetch doesn't need to be compiled, run 'make install' to install"
|
||||||
|
|
||||||
debs: options iosdeb amd64deb
|
debs: options iphoneos-armdeb amd64deb
|
||||||
|
|
||||||
debroots: options iosdebroot amd64debroot
|
debroots: options iphoneos-armdebroot amd64debroot
|
||||||
|
|
||||||
controls: options ioscontrol amd64control
|
controls: options iphoneos-armcontrol amd64control
|
||||||
|
|
||||||
options:
|
options:
|
||||||
@echo "VERSION: $(VERSION)"
|
@echo "VERSION: $(VERSION)"
|
||||||
|
|
@ -25,24 +25,24 @@ install:
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/nekofetch
|
rm -f $(DESTDIR)$(PREFIX)/bin/nekofetch
|
||||||
|
|
||||||
ioscontrol:
|
iphoneos-armcontrol:
|
||||||
cp control.template ioscontrol
|
cp control.template iphoneos-armcontrol
|
||||||
sed -i 's/PACKAGE/com.propr.nekofetch/' ioscontrol
|
sed -i 's/PACKAGE/com.propr.nekofetch/' iphoneos-armcontrol
|
||||||
sed -i 's/ARCH/iphoneos-arm/' ioscontrol
|
sed -i 's/ARCH/iphoneos-arm/' iphoneos-armcontrol
|
||||||
sed -i 's/VERSION/$(VERSION)/' ioscontrol
|
sed -i 's/VERSION/$(VERSION)/' iphoneos-armcontrol
|
||||||
amd64control:
|
amd64control:
|
||||||
cp control.template amd64control
|
cp control.template amd64control
|
||||||
sed -i 's/PACKAGE/nekofetch/' amd64control
|
sed -i 's/PACKAGE/nekofetch/' amd64control
|
||||||
sed -i 's/ARCH/amd64/' amd64control
|
sed -i 's/ARCH/amd64/' amd64control
|
||||||
sed -i 's/VERSION/$(VERSION)/' amd64control
|
sed -i 's/VERSION/$(VERSION)/' amd64control
|
||||||
|
|
||||||
iosdebroot: ioscontrol
|
iphoneos-armdebroot: iphoneos-armcontrol
|
||||||
mkdir -p iosdebroot/DEBIAN
|
mkdir -p iphoneos-armdebroot/DEBIAN
|
||||||
mkdir -p iosdebroot/usr/bin
|
mkdir -p iphoneos-armdebroot/usr/bin
|
||||||
mkdir -p iosdebroot/usr/share/doc/nekofetch
|
mkdir -p iphoneos-armdebroot/usr/share/doc/nekofetch
|
||||||
cp ioscontrol iosdebroot/DEBIAN/control
|
cp iphoneos-armcontrol iphoneos-armdebroot/DEBIAN/control
|
||||||
cp LICENSE iosdebroot/usr/share/doc/nekofetch/copyright
|
cp LICENSE iphoneos-armdebroot/usr/share/doc/nekofetch/copyright
|
||||||
cp nekofetch iosdebroot/usr/bin/nekofetch
|
cp nekofetch iphoneos-armdebroot/usr/bin/nekofetch
|
||||||
amd64debroot: amd64control
|
amd64debroot: amd64control
|
||||||
mkdir -p amd64debroot/DEBIAN
|
mkdir -p amd64debroot/DEBIAN
|
||||||
mkdir -p amd64debroot/usr/bin
|
mkdir -p amd64debroot/usr/bin
|
||||||
|
|
@ -51,14 +51,14 @@ amd64debroot: amd64control
|
||||||
cp LICENSE amd64debroot/usr/share/doc/nekofetch/copyright
|
cp LICENSE amd64debroot/usr/share/doc/nekofetch/copyright
|
||||||
cp nekofetch amd64debroot/usr/bin/nekofetch
|
cp nekofetch amd64debroot/usr/bin/nekofetch
|
||||||
|
|
||||||
iosdeb: iosdebroot
|
iphoneos-armdeb: iphoneos-armdebroot
|
||||||
dpkg-deb -b "iosdebroot" "com.propr.nekofetch_$(VERSION)_iphoneos-arm.deb"
|
dpkg-deb -b "iphoneos-armdebroot" "com.propr.nekofetch_$(VERSION)_iphoneos-arm.deb"
|
||||||
amd64deb: amd64debroot
|
amd64deb: amd64debroot
|
||||||
dpkg-deb -b "amd64debroot" "nekofetch_$(VERSION)_amd64.deb"
|
dpkg-deb -b "amd64debroot" "nekofetch_$(VERSION)_amd64.deb"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf iosdebroot amd64debroot
|
rm -rf iphoneos-armdebroot amd64debroot
|
||||||
rm -f ioscontrol amd64control
|
rm -f iphoneos-armcontrol amd64control
|
||||||
rm -f com.propr.nekofetch_*_iphoneos-arm.deb nekofetch_*_amd64.deb
|
rm -f com.propr.nekofetch_*_iphoneos-arm.deb nekofetch_*_amd64.deb
|
||||||
|
|
||||||
.PHONY: all debs debroots controls options install uninstall iosdeb amd64deb clean
|
.PHONY: all debs debroots controls options install uninstall iphoneos-armdeb amd64deb clean
|
||||||
|
|
|
||||||
83
nekofetch
83
nekofetch
|
|
@ -1,40 +1,71 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
tmpfile="$(mktemp)"
|
tmpfile="$(mktemp)"
|
||||||
imgtype=""
|
|
||||||
use_height=""
|
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
case "$1" in
|
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")
|
"--nsfw"|"nsfw"|"-n"|"n")
|
||||||
if [ "$imgtype" = "" ]; then
|
if [ -z "$imgtype" ]; then
|
||||||
[ "$DEBUG" = "true" ] && echo "Getting a nsfw image"
|
[ "$debug" = "true" ] && echo "Getting a nsfw image"
|
||||||
imgtype="nsfw"
|
imgtype="nsfw"
|
||||||
else
|
else
|
||||||
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
|
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--sfw"|"sfw"|"-s"|"s")
|
"--sfw"|"sfw"|"-s"|"s")
|
||||||
if [ "$imgtype" = "" ]; then
|
if [ -z "$imgtype" ]; then
|
||||||
[ "$DEBUG" = "true" ] && echo "Getting a sfw image"
|
[ "$debug" = "true" ] && echo "Getting a sfw image"
|
||||||
imgtype="sfw"
|
imgtype="sfw"
|
||||||
else
|
else
|
||||||
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
|
echo "$imgtype images were already chosen! Please only specify either sfw or nsfw!"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--w3m"|"w3m"|"--img"|"img"|"-i"|"i")
|
"--w3m"|"w3m"|"--img"|"img"|"-i"|"i")
|
||||||
[ "$DEBUG" = "true" ] && echo "Using w3m image backend for neofetch"
|
[ "$debug" = "true" ] && echo "Using w3m image backend for neofetch"
|
||||||
use_w3m="true"
|
use_w3m="true"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--height"|"-h")
|
"--height"|"-h")
|
||||||
if [ "$use_height" = "" ]; then
|
if [ -z "$use_height" ]; then
|
||||||
use_height="$2"
|
use_height="$2"
|
||||||
[ "$DEBUG" = "true" ] && echo "Using height $height"
|
[ "$debug" = "true" ] && echo "Using height $use_height"
|
||||||
else
|
else
|
||||||
echo "You can only specify the height argument once!"
|
echo "You can only specify the height argument once!"
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
break
|
break
|
||||||
|
|
@ -44,33 +75,51 @@ while :; do
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
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 [ "$imgtype" = "nsfw" ]; then
|
if [ ! "$offline" = "true" ]; then
|
||||||
imgurl="https://nekos.life/api/v2/img/cum_jpg"
|
if [ "$imgtype" = "nsfw" ]; then
|
||||||
else
|
imgurl="https://nekos.life/api/v2/img/cum_jpg"
|
||||||
imgurl="https://nekos.life/api/v2/img/neko"
|
else
|
||||||
|
imgurl="https://nekos.life/api/v2/img/neko"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$use_height" != "" ]; then
|
if [ -n "$use_height" ]; then
|
||||||
height="$use_height"
|
height="$use_height"
|
||||||
else
|
else
|
||||||
height="$(($(stty size | awk '{print $1}') - 5))"
|
height="$(($(stty size | awk '{print $1}') - 5))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
url=$(curl -fsSL "$imgurl" | jq -r ".url")
|
if [ "$offline" = "true" ]; then
|
||||||
[ "$DEBUG" = "true" ] && echo "Using image at url $url"
|
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
|
if [ "$TERM" = "xterm-kitty" ]; then
|
||||||
command -v convert > /dev/null 2>&1 && neofetch --kitty "$tmpfile.jpg" || kitty_imagemagick_warn=true
|
command -v convert > /dev/null 2>&1 && neofetch --kitty "$tmpfile.jpg" || kitty_imagemagick_warn=true
|
||||||
if [ "$kitty_imagemagick_warn" = "true" ]; then
|
if [ "$kitty_imagemagick_warn" = "true" ]; then
|
||||||
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
|
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
|
||||||
neofetch --source "$tmpfile"
|
neofetch --source "$tmpfile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$LC_TERMINAL" = "iTerm2" ]; then
|
elif [ "$LC_TERMINAL" = "iTerm2" ]; then
|
||||||
neofetch --iterm2 "$tmpfile.jpg"
|
neofetch --iterm2 "$tmpfile.jpg"
|
||||||
|
|
||||||
elif [ "$use_w3m" = "true" ]; then
|
elif [ "$use_w3m" = "true" ]; then
|
||||||
neofetch --w3m "$tmpfile.jpg"
|
neofetch --w3m "$tmpfile.jpg"
|
||||||
|
|
||||||
else
|
else
|
||||||
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
|
jp2a --height="$height" "$tmpfile.jpg" > "$tmpfile"
|
||||||
neofetch --source "$tmpfile"
|
neofetch --source "$tmpfile"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue