mirror of
https://github.com/eepykate/fet.sh.git
synced 2026-11-07 16:01:03 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75b665e153 | ||
|
|
a0ee667546 | ||
|
|
acec5ad4c5 | ||
|
|
b89c509aca | ||
|
|
3df3b25355 | ||
|
|
9dd1b3d698 | ||
|
|
3d615c8c91 | ||
|
|
ee56d6eed3 | ||
|
|
8c30f4a730 | ||
|
|
d336d54e98 | ||
|
|
9ae2f4d01b |
No files matched your search
@@ -1,19 +1,13 @@
|
||||
Copyright (c) 2020 Gauge Krahe
|
||||
Copyright 2020 Gauge Krahe
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -1,8 +1,20 @@
|
||||
<h2 align="center">fet.sh</h1>
|
||||
|
||||
|
||||
<div align="center">
|
||||
<h1>fet.sh</h1>
|
||||
fetch written in POSIX shell with no external commands
|
||||
<br>
|
||||
<img src="screenshot.png" width="250px">
|
||||
</div>
|
||||
|
||||
### Installing
|
||||
**Arch:** [fet.sh-git](https://aur.archlinux.org/packages/fet.sh-git/) (AUR)
|
||||
**Other Distros:** copy `fet.sh` to somewhere in $PATH
|
||||
|
||||
### Customization
|
||||
`fet.sh` can be configured using environment variables, for example:
|
||||
```
|
||||
$ info='n os wm sh n' fet.sh
|
||||
```
|
||||
Supported options are:
|
||||
- `accent` (0-7)
|
||||
- `info`
|
||||
- `separator`
|
||||
@@ -99,29 +99,36 @@ read -r model < /sys/devices/virtual/dmi/id/product_name
|
||||
[ -d /var/db/pkg ] && set -- /var/db/pkg/*/*
|
||||
[ $# -gt 0 ] && pkgs=$#
|
||||
|
||||
print() {
|
||||
[ "$2" ] && printf '\033[3%sm%6s\033[0m ~ %s\n' "${accent:-4}" "$1" "$2"
|
||||
col() {
|
||||
printf ' '
|
||||
for i in 1 2 3 4 5 6; do
|
||||
printf '\033[9%sm▅▅' "$i"
|
||||
done
|
||||
printf '\033[0m\n'
|
||||
}
|
||||
|
||||
print() {
|
||||
[ "$2" ] && printf '\033[9%sm%6s\033[0m%b%s\n' \
|
||||
"${accent:-4}" "$1" "${separator:- ~ }" "$2"
|
||||
}
|
||||
|
||||
echo
|
||||
read -r host < /etc/hostname
|
||||
printf '%7s@%s\n' "$USER" "$host"
|
||||
read -r host < /proc/sys/kernel/hostname
|
||||
|
||||
print os "$ID"
|
||||
print sh "${SHELL##*/}"
|
||||
print wm "$wm"
|
||||
print up "$up"
|
||||
print gtk "${gtk# }"
|
||||
print cpu "$vendor $cpu"
|
||||
print mem "${mem}MB"
|
||||
print host "$model"
|
||||
print kern "$kernel"
|
||||
print pkgs "$pkgs"
|
||||
print term "$term"
|
||||
|
||||
printf ' '
|
||||
for i in 1 2 3 4 5 6; do
|
||||
printf '\033[9%sm▅▅' "$i"
|
||||
for i in ${info:-n user os sh wm up gtk cpu mem host kern pkgs term col n}; do
|
||||
case $i in
|
||||
n) echo;;
|
||||
os) print os "$ID";;
|
||||
sh) print sh "${SHELL##*/}";;
|
||||
wm) print wm "$wm";;
|
||||
up) print up "$up";;
|
||||
gtk) print gtk "${gtk# }";;
|
||||
gpu) print cpu "$vendor $cpu";;
|
||||
mem) print mem "${mem}MB";;
|
||||
host) print host "$model";;
|
||||
kern) print kern "$kernel";;
|
||||
pkgs) print pkgs "$pkgs";;
|
||||
term) print term "$term";;
|
||||
user) printf '%7s@%s\n' "$USER" "$host";;
|
||||
col) col;;
|
||||
esac
|
||||
done
|
||||
printf '\033[0m\n\n'
|
||||
Reference in new issue
Block a user