Oh My Fucking GOD. WHY DO I KEEP MAKING THESE MISTAKES. Oh yeah I also updated the installer.
This commit is contained in:
@@ -5,17 +5,13 @@ red = "\e[0;31m"
|
||||
bold = "\033[1m"
|
||||
reset = "\e[0m"
|
||||
|
||||
lib C
|
||||
fun getuid : UInt32
|
||||
end
|
||||
|
||||
sudo_user = ENV["SUDO_USER"]?
|
||||
home = "/home/#{sudo_user}"
|
||||
|
||||
OptionParser.parse do |parser|
|
||||
parser.banner = "Usage: installer [arguments]"
|
||||
parser.on("-i", "--install-only", "Only instals wfetch; Does not run setup") {
|
||||
if C.getuid != 0
|
||||
if LibC.getuid != 0
|
||||
puts "#{red}#{bold}You must be in root to install wfetch!#{reset}"
|
||||
exit(0)
|
||||
end
|
||||
@@ -28,7 +24,7 @@ OptionParser.parse do |parser|
|
||||
exit
|
||||
}
|
||||
parser.on("-u", "--uninstall", "Uninstalls wfetch"){
|
||||
if C.getuid != 0
|
||||
if LibC.getuid != 0
|
||||
puts "#{red}#{bold}You must be in root to uninstall wfetch!#{reset}"
|
||||
exit(0)
|
||||
end
|
||||
@@ -41,12 +37,12 @@ OptionParser.parse do |parser|
|
||||
exit
|
||||
}
|
||||
parser.on("-s", "--setup", "Runs setup") {
|
||||
if C.getuid = 0
|
||||
if LibC.getuid == 0
|
||||
puts "#{red}#{bold}Don't run the setup in root!#{reset}"
|
||||
exit(0)
|
||||
end
|
||||
|
||||
Dir.mkdir("/home/#{sudo_user}/.local/share/Wfetch")
|
||||
Dir.mkdir("~//.local/share/Wfetch")
|
||||
|
||||
|
||||
puts "Please enter your WeatherApi key (Learn to get one at README.md):"
|
||||
@@ -93,3 +89,4 @@ OptionParser.parse do |parser|
|
||||
|
||||
if ARGV.empty?
|
||||
puts "Run installer -h"
|
||||
end
|
||||
@@ -81,8 +81,24 @@ module Wfetch
|
||||
windchill_c = data["current"]["windchill_c"]
|
||||
id = data["current"]["condition"]["code"]
|
||||
|
||||
disp = TOML.parse(File.read(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)))
|
||||
|
||||
if debug == true
|
||||
disp = TOML.parse("
|
||||
1 = \"{icon}\"
|
||||
2 = \"Live Temperature: {temp_f}°F\"
|
||||
3 = \"Live Temperature: {temp_c}°C\"
|
||||
4 = \"Feels like: {feels_like_f}°F\"
|
||||
5 = \"Feels like: {feels_like_c}°C\"
|
||||
6 = \"Wind Speed: {wind_mph} MPH\"
|
||||
7 = \"Wind Speed: {wind_kph} KPH\"
|
||||
8 = \"Humidity: {humidity}%\"
|
||||
9 = \"Pressure: {pressure_in} IN\"
|
||||
10 = \"Pressure: {pressure_mb} MB\"
|
||||
11 = \"Description: {orange}{bold}{description}{reset}\"
|
||||
12 = \"{goodbye}\"
|
||||
")
|
||||
else
|
||||
disp = TOML.parse(File.read(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)))
|
||||
end
|
||||
|
||||
repeat = 1
|
||||
|
||||
@@ -127,7 +143,7 @@ module Wfetch
|
||||
"{goodbye}" => message
|
||||
}
|
||||
|
||||
File.each_line("/home/koffeejava/.local/share/Wfetch/disp.toml") do |line|
|
||||
File.each_line(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)) do |line|
|
||||
entry = disp["#{repeat}"]?
|
||||
|
||||
if entry
|
||||
|
||||
Reference in New Issue
Block a user