Class: Worktool::Command

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/worktool/command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/worktool/command.rb', line 6

def execute
  commands = []
  params = Worktool::Github.new.extract(query)
  manager = Worktool::ProjectManager.new(ENV['PROJECTS_PATH'])
  repo = manager.find_repo_path(params)
  if repo
    commands << 'cd ' + Shellwords.escape(repo.to_s)
    if params[:issue]
      commands << 'gi checkout ' + Shellwords.escape(params[:issue].to_s)
    end
  else
    commands << '# Repo not found'
  end
  puts commands.join(' && ')
end