Update trufetch before removing it

This commit is contained in:
Donovan Glover 2018-01-20 23:51:32 -05:00
parent e87a81db73
commit 7d70e11f59
No known key found for this signature in database
GPG Key ID: 8FC5F7D90A5D8F4D

View File

@ -24,61 +24,40 @@
# Trufetch is an alternative to neofetch that emphasizes the use of true color support # Trufetch is an alternative to neofetch that emphasizes the use of true color support
# It is made specifically for this system and does not rely on many external calls # It is made specifically for this system and does not rely on many external calls
require "trucolor" require "./trucolor"
module Trufetch
extend self
def trufetch()
Trufetch.fetch() if ARGV.size() == 0
case ARGV[0].delete("-")
when "help", "h"; Trufetch.help()
else Trufetch.unknown()
end
end
def fetch() def fetch()
# These values are queried manually since they change often
uptime = `uptime -p`.lchop("up ").split(",") uptime = `uptime -p`.lchop("up ").split(",")
packages = `pacman -Qq --color never | wc -l` packages = `pacman -Qq --color never | wc -l`
resolution = `xrandr | grep '*'`.split('"')[1].split('_')[0] resolution = `xrandr | grep '*'`.split('"')[1].split('_')[0]
kernel = `uname -r`
os = `uname -o`.chomp()
type = `uname -m`
zsh_version = `zsh --version`.split(" ")[1]
add_banner("New Start") # add_banner("New Start")
add("OS", "GNU/Linux (Arch)")
# TODO: Test this with different inputs # TODO: Test this with different inputs
# TODO: Handle the edge case where there's only one item # TODO: Handle the edge case where there's only one item
add("Uptime", uptime[0] + "," + uptime[1]) puts ""
puts add("OS", "Parabola #{os} #{type}")
add("Packages", packages) puts add("Kernel", kernel)
add("Shell", "zsh") puts add("Uptime", uptime[0] + "," + uptime[1])
add("Resolution", resolution) puts add("Packages", packages)
add("Window Manager", "i3-gaps") puts add("Shell", "zsh #{zsh_version}")
add("Terminal", "termite") puts add("Resolution", resolution)
add("Fonts", "Noto, Hack") puts add("WM", "i3-gaps")
exit 0 puts add("Terminal", "termite")
end puts add("Terminal Font", "Hack")
puts ""
def help()
puts "Help"
exit 0
end
def unknown()
puts "Unknown"
exit 0
end end
def add(section, contents) def add(section, contents)
message = section + ": " + contents return Trucolor.format({255, 0, 128}, section) + ": " + contents
puts message
end end
def add_banner(text) def add_banner(text)
puts text puts text
puts "-" * text.size()
end end
end fetch()
Trufetch.trufetch()