From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.213.28.69 with SMTP id l5cs332655ebc; Sun, 17 Jan 2010 10:51:51 -0800 (PST) Received: by 10.224.86.199 with SMTP id t7mr3879251qal.142.1263754310827; Sun, 17 Jan 2010 10:51:50 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 26si10291144qwa.30.2010.01.17.10.51.50; Sun, 17 Jan 2010 10:51:50 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 157AE18582E7; Sun, 17 Jan 2010 13:51:50 -0500 (EST) Received: from magnesium.club.cc.cmu.edu (MAGNESIUM.CLUB.CC.cmu.edu [128.237.157.15]) by rubyforge.org (Postfix) with ESMTP id 41E4918582CC for ; Sun, 17 Jan 2010 13:51:36 -0500 (EST) Received: (qmail 11071 invoked from network); 17 Jan 2010 18:51:35 -0000 Received: from pion.club.cc.cmu.edu (HELO localhost.localdomain) (128.237.157.88) by magnesium.club.cc.cmu.edu with SMTP; 17 Jan 2010 18:51:35 -0000 From: Rich Lane To: sup-devel@rubyforge.org Date: Sun, 17 Jan 2010 10:50:47 -0800 Message-Id: <1263754247-20979-4-git-send-email-rlane@club.cc.cmu.edu> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1263754247-20979-3-git-send-email-rlane@club.cc.cmu.edu> References: <1263754247-20979-1-git-send-email-rlane@club.cc.cmu.edu> <1263754247-20979-2-git-send-email-rlane@club.cc.cmu.edu> <1263754247-20979-3-git-send-email-rlane@club.cc.cmu.edu> Subject: [sup-devel] [PATCH 3/3] simplify sup-add X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org --- bin/sup-add | 40 ---------------------------------------- 1 files changed, 0 insertions(+), 40 deletions(-) diff --git a/bin/sup-add b/bin/sup-add index 059a4e2..e354ea8 100755 --- a/bin/sup-add +++ b/bin/sup-add @@ -30,50 +30,10 @@ EOS opt :unusual, "Do not automatically poll these sources for new messages." opt :labels, "A comma-separated set of labels to apply to all messages from this source", :type => String opt :force_new, "Create a new account for this source, even if one already exists." - opt :force_account, "Reuse previously defined account user@hostname.", :type => String end Trollop::die "require one or more sources" if ARGV.empty? -## for sources that require login information, prompt the user for -## that. also provide a list of previously-defined login info to -## choose from, if any. -def get_login_info uri, sources - uri = URI(uri) - accounts = sources.map do |s| - next unless s.respond_to?(:username) - suri = URI(s.uri) - [suri.host, s.username, s.password] - end.compact.uniq.sort_by { |h, u, p| h == uri.host ? 0 : 1 } - - username, password = nil, nil - unless accounts.empty? || $opts[:force_new] - if $opts[:force_account] - host, username, password = accounts.find { |h, u, p| $opts[:force_account] == "#{u}@#{h}" } - unless username && password - say "No previous account #{$opts[:force_account].inspect} found." - end - else - say "Would you like to use the same account as for a previous source for #{uri}?" - choose do |menu| - accounts.each do |host, olduser, oldpw| - menu.choice("Use the account info for #{olduser}@#{host}") { username, password = olduser, oldpw } - end - menu.choice("Use a new account") { } - menu.prompt = "Account selection? " - end - end - end - - unless username && password - username = ask("Username for #{uri.host}: "); - password = ask("Password for #{uri.host}: ") { |q| q.echo = false } - puts # why? - end - - [username, password] -end - $terminal.wrap_at = :auto Redwood::start index = Redwood::Index.init -- 1.6.3.3 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel