Class: Toolshed::Commands::CheckoutBranch
- Inherits:
-
Object
- Object
- Toolshed::Commands::CheckoutBranch
- Defined in:
- lib/toolshed/commands/checkout_branch.rb
Instance Method Summary collapse
Instance Method Details
#execute(args, options = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/toolshed/commands/checkout_branch.rb', line 4 def execute(args, = {}) branch_name = read_user_input("Ticket ID or Branch Name:", ) branch_name = Toolshed::Git::Base.checkout(branch_name) puts "Switched to '#{branch_name}'" end |
#read_user_input(message, options) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/toolshed/commands/checkout_branch.rb', line 10 def read_user_input(, ) return [:branch_name] if (.has_key?(:branch_name)) puts value = $stdin.gets.chomp until (!value.empty?) puts "Branch name cannot be empty" puts value = $stdin.gets.chomp end value end |