sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 36b805d0ac4246562c00c38ae1c21ab65e774e17
parent 25756e74a2a30f64c3b18cb2568b646671415e69
Author: Zeger-Jan van de Weg <mail@zjvandeweg.nl>
Date:   Mon, 10 Aug 2015 13:16:47 +0200

Move all color files + fix typos

Diffstat:
M bin/sup | 11 ++++++-----
M lib/sup.rb | 4 ++--
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/bin/sup b/bin/sup
@@ -23,14 +23,14 @@ require 'trollop'
 # In the future, this is to be removed, probably if you never remember
 # sup being in the ~/.sup folder
 def xdg_config_dir
-  ENV['SUP_BASE'] if ENV['SUP_BASE']
+  return ENV['SUP_BASE'] if ENV['SUP_BASE']
 
   dir = ENV['XDG_CONFIG_HOME'] || File.join(ENV['HOME'], '.config/')
   File.join(dir, 'sup')
 end
 
 def xdg_data_dir
-  ENV['SUP_BASE'] if ENV['SUP_BASE']
+  return ENV['SUP_BASE'] if ENV['SUP_BASE']
 
   dir = ENV['XDG_DATA_HOME'] || File.join(ENV['HOME'], '.local/share/')
   File.join(dir, 'sup')
@@ -41,11 +41,12 @@ if Dir.exist?((old_sup_dir = File.join(ENV["HOME"], ".sup"))) && !ENV['SUP_BASE'
   FileUtils.mkdir_p xdg_data_dir
 
   FileUtils.cd old_sup_dir do
-    files = Dir.entries old_sup_dir
-    %w(config.yaml sources.yaml colors.yaml).each do |file|
-      FileUtils.mv file, xdg_config_dir if files.include? file
+    config_files = Dir.entries(old_sup_dir).select do |file| 
+      file =~ /(config|sources|colors)\.?\w*\.yaml(.bak)?/i
     end
 
+    config_files.each { |file| FileUtils.mv file, xdg_config_dir }
+
     FileUtils.mv Dir.glob("*"), xdg_data_dir
   end
   FileUtils.remove_dir old_sup_dir
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -50,12 +50,12 @@ module Redwood
     DATA_DIR = ENV['SUP_BASE']
   else
    CONFIG_DIR = if ENV['XDG_CONFIG_HOME'] 
-		  File.join(ENV['XDG_CONFIG_DIR'], "sup")
+		  File.join(ENV['XDG_CONFIG_HOME'], "sup")
 		else
 		  File.join(ENV['HOME'], ".config/sup")
 		end
    DATA_DIR = 	if ENV['XDG_DATA_HOME']
-		  File.join(['XDG_DATA_HOME'], "sup")
+		  File.join(ENV['XDG_DATA_HOME'], "sup")
 		else
 		  File.join(ENV['HOME'], ".local/share/sup")
 		end