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 def fetch()
extend self uptime = `uptime -p`.lchop("up ").split(",")
packages = `pacman -Qq --color never | wc -l`
def trufetch() resolution = `xrandr | grep '*'`.split('"')[1].split('_')[0]
Trufetch.fetch() if ARGV.size() == 0 kernel = `uname -r`
case ARGV[0].delete("-") os = `uname -o`.chomp()
when "help", "h"; Trufetch.help() type = `uname -m`
else Trufetch.unknown() zsh_version = `zsh --version`.split(" ")[1]
end
end
def fetch()
# These values are queried manually since they change often
uptime = `uptime -p`.lchop("up ").split(",")
packages = `pacman -Qq --color never | wc -l`
resolution = `xrandr | grep '*'`.split('"')[1].split('_')[0]
add_banner("New Start")
add("OS", "GNU/Linux (Arch)")
# TODO: Test this with different inputs
# TODO: Handle the edge case where there's only one item
add("Uptime", uptime[0] + "," + uptime[1])
add("Packages", packages)
add("Shell", "zsh")
add("Resolution", resolution)
add("Window Manager", "i3-gaps")
add("Terminal", "termite")
add("Fonts", "Noto, Hack")
exit 0
end
def help()
puts "Help"
exit 0
end
def unknown()
puts "Unknown"
exit 0
end
def add(section, contents)
message = section + ": " + contents
puts message
end
def add_banner(text)
puts text
end
# add_banner("New Start")
# TODO: Test this with different inputs
# TODO: Handle the edge case where there's only one item
puts ""
puts add("OS", "Parabola #{os} #{type}")
puts add("Kernel", kernel)
puts add("Uptime", uptime[0] + "," + uptime[1])
puts add("Packages", packages)
puts add("Shell", "zsh #{zsh_version}")
puts add("Resolution", resolution)
puts add("WM", "i3-gaps")
puts add("Terminal", "termite")
puts add("Terminal Font", "Hack")
puts ""
end end
Trufetch.trufetch() def add(section, contents)
return Trucolor.format({255, 0, 128}, section) + ": " + contents
end
def add_banner(text)
puts text
puts "-" * text.size()
end
fetch()