all repos — dotfiles @ f158d1fa05f036a187d999c2555d19b322d5ce21

my *nix dotfiles

bin/info (view raw)

 1#!/usr/bin/env bash
 2# icyinfo, but better
 3
 4export BLK="\e[30m"
 5export RED="\e[31m"
 6export GRN="\e[32m"
 7export YLW="\e[33m"
 8export BLU="\e[34m"
 9export PUR="\e[35m"
10export CYN="\e[36m"
11export BRED="\e[31m"
12export BGRN="\e[32m"
13export BYLW="\e[33m"
14export BBLU="\e[34m"
15export BPUR="\e[35m"
16export BCYN="\e[36m"
17export WHT="\e[37m"
18export RST="\e[0m"
19
20#BAR="████"
21#((LEN = ${#BAR} * 6))
22#COLOR_BARS="$RED$BAR$GRN$BAR$YLW$BAR$BLU$BAR$PUR$BAR$CYN$BAR$RST"
23
24basename() {
25    # Usage: basename "path" ["suffix"]
26    local tmp
27
28    tmp=${1%"${1##*[!/]}"}
29    tmp=${tmp##*/}
30    tmp=${tmp%"${2/"$tmp"}"}
31
32    printf '%s\n' "${tmp:-/}"
33}
34
35prinfo() {
36    # 1 - field
37    # 2 - info
38	# 3 - prev line
39	prev_line="$1$2"
40	export prev_line	
41
42
43	printf '\e[%sD\e[B' "${#3}"
44    printf '%b' "${YLW}$1${RST}$2"
45}
46
47user="$USER"
48host="$HOSTNAME"
49kernel="$(uname -r)"
50shell="$(basename "$SHELL")"
51
52art="
53${GRN}
54    o 
55.oo.Oo.
56   O. 
57    Ooo'${RST}
58 ${RED}___${RST}${GRN}O${RST}${RED}___
59 \     /
60  \___/${RST}
61"
62
63. /etc/os-release
64os="$ID"
65pkgs="$(kiss l | wc -l)"
66
67printf '\e[2J'
68printf '\e[?25l'
69
70printf '%b\n' "$art"
71
72printf '%b\n' "${CYN}$user${RST}@${CYN}$host${RST}"
73
74prinfo "os" "          $os"
75prinfo "kernel" "      $kernel" "$prev_line"
76prinfo "pkgs" "        $pkgs" "$prev_line"
77prinfo "shell" "       $shell" "$prev_line"
78
79
80# Pause
81read -rsn1 _
82reset