Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

switchのOAuth対応 #130

Merged
1 commit merged into from

3 participants

@authorNari

https://github.com/jugyo/termtter/issues/closed/#issue/129
で報告した物を直しました。マージしてもらえると嬉しいです。

@Sixeight
Collaborator

独断と偏見により取り込みました。

@jugyo
Owner

あざっす!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 22, 2010
  1. @authorNari
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 9 deletions.
  1. +21 −9 lib/plugins/defaults/switch.rb
View
30 lib/plugins/defaults/switch.rb
@@ -10,18 +10,30 @@ module Termtter::Client
passwords[config.user_name] = config.password
- if user_name
- config.user_name = normalize_as_user_name(arg)
- if passwords.key?(config.user_name)
- config.password = passwords[config.user_name]
- else
- config.__clear__(:password)
+ file_name_prefix = File.join(Termtter::CONF_DIR, config.token_file_name)
+ unless user_name
+ choices = [:new, ""]
+ choices += Dir.glob(file_name_prefix + "_*").map{|f| f.gsub(file_name_prefix+'_', '')}
+
+ puts "0. New user"
+ puts "1. Default"
+ choices[2..-1].each_with_index do |c, i|
+ puts "#{i+2}. #{c}"
+ end
+ ui = create_highline
+ choice = choices[ui.ask("Please choice number: ").to_i]
+ if choice.nil?
+ puts "Invalid number"
+ break
end
- else
- config.__clear__(:user_name)
- config.__clear__(:password)
+ user_name = (choice == :new) ? ui.ask("Enter user name: ") : choice
end
+ config.token_file = file_name_prefix
+ config.token_file += "_#{user_name}" if user_name != ""
+ config.__clear__(:access_token)
+ config.__clear__(:access_token_secret)
+
Termtter::API.setup
execute('reload')
},
Something went wrong with that request. Please try again.