Oh My Fucking GOD. WHY DO I KEEP MAKING THESE MISTAKES. Oh yeah I also updated the installer.

This commit is contained in:
koffeejava
2026-03-13 18:57:34 -06:00
parent b8e1bcf5c8
commit 132df9d30a
2 changed files with 25 additions and 12 deletions

View File

@@ -5,17 +5,13 @@ red = "\e[0;31m"
bold = "\033[1m" bold = "\033[1m"
reset = "\e[0m" reset = "\e[0m"
lib C
fun getuid : UInt32
end
sudo_user = ENV["SUDO_USER"]? sudo_user = ENV["SUDO_USER"]?
home = "/home/#{sudo_user}" home = "/home/#{sudo_user}"
OptionParser.parse do |parser| OptionParser.parse do |parser|
parser.banner = "Usage: installer [arguments]" parser.banner = "Usage: installer [arguments]"
parser.on("-i", "--install-only", "Only instals wfetch; Does not run setup") { 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}" puts "#{red}#{bold}You must be in root to install wfetch!#{reset}"
exit(0) exit(0)
end end
@@ -28,7 +24,7 @@ OptionParser.parse do |parser|
exit exit
} }
parser.on("-u", "--uninstall", "Uninstalls wfetch"){ 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}" puts "#{red}#{bold}You must be in root to uninstall wfetch!#{reset}"
exit(0) exit(0)
end end
@@ -41,12 +37,12 @@ OptionParser.parse do |parser|
exit exit
} }
parser.on("-s", "--setup", "Runs setup") { 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}" puts "#{red}#{bold}Don't run the setup in root!#{reset}"
exit(0) exit(0)
end 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):" puts "Please enter your WeatherApi key (Learn to get one at README.md):"
@@ -93,3 +89,4 @@ OptionParser.parse do |parser|
if ARGV.empty? if ARGV.empty?
puts "Run installer -h" puts "Run installer -h"
end

View File

@@ -81,8 +81,24 @@ module Wfetch
windchill_c = data["current"]["windchill_c"] windchill_c = data["current"]["windchill_c"]
id = data["current"]["condition"]["code"] 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 repeat = 1
@@ -127,7 +143,7 @@ module Wfetch
"{goodbye}" => message "{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}"]? entry = disp["#{repeat}"]?
if entry if entry