bin/sup in sup-0.12.1 vs bin/sup in sup-0.13.0
- old
+ new
@@ -1,28 +1,31 @@
#!/usr/bin/env ruby
require 'rubygems'
-no_ncursesw = false
+require 'ncursesw'
+
+no_gpgme = false
begin
- require 'ncursesw'
+ # gpgme broke its API in 2.0, so make sure we have the old version for now.
+ gem 'gpgme', '=1.0.8'
+ require 'gpgme'
rescue LoadError
- require 'ncurses'
- no_ncursesw = true
+ no_gpgme = true
end
require 'fileutils'
require 'trollop'
-require "sup"; Redwood::check_library_version_against "0.12.1"
+require "sup"; Redwood::check_library_version_against "0.13.0"
if ENV['SUP_PROFILE']
require 'ruby-prof'
RubyProf.start
end
-if no_ncursesw
- info "No 'ncursesw' gem detected. Install it for wide character support."
+if no_gpgme
+ info "No 'gpgme' gem detected. Install it for email encryption, decryption and signatures."
end
$opts = Trollop::options do
version "sup v#{Redwood::VERSION}"
banner <<EOS
@@ -102,13 +105,14 @@
## this works, i have no idea. much like pretty much every aspect of
## dealing with curses. cargo cult programming at its best.
##
## BSD users: if libc.so.6 is not found, try installing compat6x.
require 'dl/import'
+require 'rbconfig'
module LibC
extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable
- setlocale_lib = case Config::CONFIG['arch']
+ setlocale_lib = case RbConfig::CONFIG['arch']
when /darwin/; "libc.dylib"
when /cygwin/; "cygwin1.dll"
else; "libc.so.6"
end
@@ -119,11 +123,11 @@
debug "setting locale..."
LibC.setlocale(6, "") # LC_ALL == 6
rescue RuntimeError => e
warn "cannot dlload setlocale(); ncurses wide character support probably broken."
warn "dlload error was #{e.class}: #{e.message}"
- if Config::CONFIG['arch'] =~ /bsd/
+ if RbConfig::CONFIG['arch'] =~ /bsd/
warn "BSD variant detected. You may have to install a compat6x package to acquire libc."
end
end
end
@@ -285,11 +289,14 @@
bm.spawn_unless_exists("buffer list", :system => true) { BufferListMode.new }
when :list_contacts
b, new = bm.spawn_unless_exists("Contact List") { ContactListMode.new }
b.mode.load_in_background if new
when :search
- query = BufferManager.ask :search, "Search all messages (enter for saved searches): "
+ completions = LabelManager.all_labels.map { |l| "label:#{LabelManager.string_for l}" }
+ completions = completions.each { |l| l.force_encoding 'UTF-8' if l.methods.include?(:encoding) }
+ completions += ["from:", "to:", "after:", "before:", "date:", "limit:", "AND", "OR", "NOT"]
+ query = BufferManager.ask_many_with_completions :search, "Search all messages (enter for saved searches): ", completions
unless query.nil?
if query.empty?
bm.spawn_unless_exists("Saved searches") { SearchListMode.new }
else
SearchResultsMode.spawn_from_query query
@@ -402,17 +409,17 @@
f.puts e.message, e.backtrace
end
end
$stderr.puts <<EOS
----------------------------------------------------------------
-I'm very sorry. It seems that an error occurred in Sup. Please
-accept my sincere apologies. Please submit the contents of
+We are very sorry. It seems that an error occurred in Sup. Please
+accept our sincere apologies. Please submit the contents of
#{BASE_DIR}/exception-log.txt and a brief report of the
-circumstances to http://masanjin.net/sup-bugs/ so that I might
-address this problem. Thank you!
+circumstances to https://github.com/sup-heliotrope/sup/issues so that
+we might address this problem. Thank you!
Sincerely,
-William
+The Sup Developers
----------------------------------------------------------------
EOS
Redwood::exceptions.each do |e, name|
puts "--- #{e.class.name} from thread: #{name}"
puts e.message, e.backtrace