summarylogtreecommitdiffstats
path: root/comfetch
blob: a21b72a5d1ee63a560a972b58f5c9c7881f70ced (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
os=$(/bin/cat /etc/os-release | grep "PRETTY_NAME" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}')
user=$(whoami)
hostname=$(uname -n)
kernel=$(uname -r)
usedmem=$(free --mebi | grep "Mem:" | awk '{print $3}')
totalmem=$(free --mebi | grep "Mem:" | awk '{print $2}')
ansicolor=" \u001b[$(/bin/cat /etc/os-release | grep "ANSI_COLOR" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}')m"
reset="\u001b[0m"

function fetch(){
echo -e "$ansicolor""    .--.     ""USER$reset | $user"
echo -e "$ansicolor""   |o_o |    ""HOST$reset | $hostname"
echo -e "$ansicolor""   |:_/ |    ""OS  $reset | $os"
echo -e "$ansicolor""  //   \ \\   ""KERN$reset | $kernel"
echo -e "$ansicolor"" (|     | )  ""RAM $reset | $usedmem""MiB/""$totalmem""MiB"
echo -e "$ansicolor""/'|_   _/'\\ $reset"
echo -e "$ansicolor""\\___)=(___/ $reset"
}

for arg in $@; do
	if [ $arg = "-h" ] || [ $arg = "--help" ]; then
		function fetch(){
		echo "Usage: comfetch [switches]"
		echo "  -h or --help     | Show this message"
		echo "  -nc or --nocolor | Don't use colors"
		}
	elif [ $arg = "-nc" ] || [ $arg = "--nocolor" ]; then
		ansicolor=" "
		reset=""
	fi
done

fetch