bin/sup in sup-0.4 vs bin/sup in sup-0.5

- old
+ new

@@ -5,11 +5,11 @@ require 'curses' require 'fileutils' require 'trollop' require "sup" -BIN_VERSION = "0.4" +BIN_VERSION = "0.5" unless Redwood::VERSION == BIN_VERSION $stderr.puts <<EOS Error: version mismatch! @@ -30,16 +30,23 @@ Usage: sup [options] Options are: EOS - opt :list_hooks, "List all hooks and descriptions thereof, and quit." - opt :no_threads, "Turn of threading. Helps with debugging. (Necessarily disables background polling for new messages.)" + opt :list_hooks, "List all hooks and descriptions, and quit." + opt :no_threads, "Turn off threading. Helps with debugging. (Necessarily disables background polling for new messages.)" opt :no_initial_poll, "Don't poll for new messages when starting." - opt :search, "Search for threads ", :type => String + opt :search, "Search for this query upon startup", :type => String + opt :compose, "Compose message to this recipient upon startup", :type => String end +Redwood::HookManager.register "startup", <<EOS +Executes at startup +No variables. +No return value. +EOS + if $opts[:list_hooks] Redwood::HookManager.print_hooks exit end @@ -92,11 +99,11 @@ h.wrap_at = :auto h.say Index.fancy_lock_error_message_for(e) case h.ask("Should I ask that process to kill itself? ") when /^\s*y\s*$/i - h.say "Ok, suggesting sepuku..." + h.say "Ok, suggesting seppuku..." FileUtils.touch Redwood::SUICIDE_FN sleep SuicideManager::DELAY * 2 FileUtils.rm_f Redwood::SUICIDE_FN h.say "Let's try that again." retry @@ -125,20 +132,24 @@ else Redwood::log "no sent mail source, auto-adding..." Index.add_source SentManager.new_source end + HookManager.run "startup" + log "starting curses" start_cursing Colormap.new do |c| c.add :status_color, Ncurses::COLOR_WHITE, Ncurses::COLOR_BLUE, Ncurses::A_BOLD c.add :index_old_color, Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK c.add :index_new_color, Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK, Ncurses::A_BOLD c.add :index_starred_color, Ncurses::COLOR_YELLOW, Ncurses::COLOR_BLACK, Ncurses::A_BOLD + c.add :index_draft_color, Ncurses::COLOR_RED, Ncurses::COLOR_BLACK, + Ncurses::A_BOLD c.add :labellist_old_color, Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK c.add :labellist_new_color, Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK, Ncurses::A_BOLD c.add :twiddle_color, Ncurses::COLOR_BLUE, Ncurses::COLOR_BLACK c.add :label_color, Ncurses::COLOR_YELLOW, Ncurses::COLOR_BLACK @@ -196,10 +207,14 @@ end end unless $opts[:no_initial_poll] imode.load_threads :num => ibuf.content_height, :when_done => lambda { reporting_thread("poll after loading inbox") { sleep 1; PollManager.poll } unless $opts[:no_threads] || $opts[:no_initial_poll] } + if $opts[:compose] + ComposeMode.spawn_nicely :to_default => $opts[:compose] + end + unless $opts[:no_threads] PollManager.start SuicideManager.start Index.start_lock_update_thread end @@ -296,10 +311,10 @@ Redwood::finish stop_cursing Redwood::log "stopped cursing" if SuicideManager.instantiated? && SuicideManager.die? - Redwood::log "I've been ordered to commit sepuku. I obey!" + Redwood::log "I've been ordered to commit seppuku. I obey!" end if $exceptions.empty? Redwood::log "no fatal errors. good job, william." Index.save