Class: Toolshed::Commands::CheckoutBranch
- Inherits:
-
Object
- Object
- Toolshed::Commands::CheckoutBranch
- Defined in:
- lib/toolshed/commands/checkout_branch.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cli_options ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/toolshed/commands/checkout_branch.rb', line 6 def self. { banner: 'Usage: checkout_branch [options]', options: { branch_name: { short_on: '-b', } } } end |
Instance Method Details
#execute(args, options = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/toolshed/commands/checkout_branch.rb', line 17 def execute(args, = {}) branch_name = read_user_input("Ticket ID or Branch Name:", ) Toolshed::Git::Branch.checkout(branch_name) Toolshed.die end |
#read_user_input(message, options) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/toolshed/commands/checkout_branch.rb', line 23 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 |