all repos — dotfiles @ f713de8850ef33ed54eb44bbec2af3fd797ad8b7

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' "${BLU}$1${RST}$2"
45}
46
47user="$USER"
48host="$HOSTNAME"
49kernel="$(uname -r)"
50shell="$(basename "$SHELL")"
51
52# cactus art
53#art="
54#${GRN}
55#    o 
56#.oo.Oo.
57#   O. 
58#    Ooo'${RST}
59# ${RED}___${RST}${GRN}O${RST}${RED}___
60# \     /
61#  \___/${RST}
62#"
63
64# blowfish
65
66printf '\e[?25l'
67art="
68${YLW}      \.-----./
69      / ^ ^ ^ \ ${RST}
70    (${PUR}o${RST})(${PUR}o${RST})${YLW} ^ ^ |_/|${RST}
71     ${RED}{}${RST} ${YLW}^ ^ > ^| \|
72      \^ ^ ^ ^/
73       /-----\\ ${RST}
74
75"
76
77printf '%b' "$art"
78os="$(uname)"
79pkgs="$(pkg_info | wc -l)"
80
81printf '%b\n' "${CYN}$user${RST}@${CYN}$host${RST}"
82
83prinfo "os" "          $os"
84prinfo "kernel" "      $kernel" "$prev_line"
85prinfo "pkgs" "   $pkgs" "$prev_line"
86prinfo "shell" "       $shell" "$prev_line"
87
88
89# Pause
90read -rsn1 _
91printf '\n'
92printf '\e[?25h'