summarylogtreecommitdiffstats
path: root/mlfetch
blob: ac1cdb8f9135f335250a34f67d1416b5de602931 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# MLFetch - the fetch for minimalism
# By MLevankov

#!/bin/sh

init_fetch() {
	export os=$(uname -r)
	export date=$(date)
	export user_name=$(whoami)
	export host_name=$(cat /etc/hostname)
	export sh=$(basename "${SHELL}")
	export uptime=$(uptime)
}

show_help() {
	echo -e "--help - Showing help\n"
	echo "--logo - Set logo"
	echo -e "Example: mlfetch --logo logo/freebsd.txt\n"
	echo "--log - Saves info to log"
	echo "Example: mlfetch --log fetch.log"
}

show_fetch() {
	echo "OS: ${os}"
	echo "Date: ${date}"
	echo "Username: ${user_name}"
	echo "Hostname: ${host_name}"
	echo "Terminal: ${TERM}"
	echo "Shell: ${sh}"
	echo "Uptime: ${uptime}"
}

save_to_log() {
	cat > $log << EOF
OS: ${os}
Date: ${date}
Username: ${user_name}
Hostname: ${host_name}
Terminal: ${TERM}
Shell: ${sh}
Uptime: ${uptime}
EOF
}

init_fetch

if [ "$1" = "--log" ]
then
	log="$2" save_to_log
elif [ "$1" = "--logo" ]
then
	cat "$2"
	show_fetch
elif [ "$1" = "--help" ]
then
	show_help
else
	show_fetch
fi