start <id> is not working
Closed this issue · 6 comments
Existing issue, RVM 1.9.3p392, pt version 0.6.4
issuing command pt start 49367347
on an existing issue gets me this stacktrace:
/Users/roman/.rvm/gems/ruby-1.9.3-p392/gems/pt-0.6.4/lib/pt/ui.rb:220:in `start': undefined method `name' for nil:NilClass (NoMethodError)
from /Users/roman/.rvm/gems/ruby-1.9.3-p392/gems/pt-0.6.4/lib/pt/ui.rb:20:in `initialize'
from /Users/roman/.rvm/gems/ruby-1.9.3-p392/gems/pt-0.6.4/bin/pt:10:in `new'
from /Users/roman/.rvm/gems/ruby-1.9.3-p392/gems/pt-0.6.4/bin/pt:10:in `<top (required)>'
from /Users/roman/.rvm/gems/ruby-1.9.3-p392/bin/pt:19:in `load'
from /Users/roman/.rvm/gems/ruby-1.9.3-p392/bin/pt:19:in `<main>'
from /Users/roman/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/roman/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
Happy to provide more details if needs, thanks in advance!
This is a legitimate grievance because lately I've come to terms that my initial way of creating pt's commands is wrong. pt start [id]
actually uses the "num" id from the command pt
. It made sense as I built it but in retrospect it doesn't now. I will move all of the commands that take ids to use pivotal tracker ids.
Thanks for your reply! That makes sense then - great I asked the question before trying to dig into the issue on my own. :-)
I think you can close this ticket, I tried using the ordered numbers from the output of the pt
command and it all worked as expected. I am fine with either of the ways of supplying the ticket number - using internal pt
numbering saves time copying and pasting - so you might think of making it an option as well 👍
I think if the number is over 1000 you can presume its a story id, otherwise it's using my system.
Yup, found that in the code: unfortunately this convention does not seem to apply to some other commands, like show
. Is there any reason for not extending this rule to all methods taking a task id as one of their parameters?
It seems to me that this change will do the trick IMHO:
def get_task_from_params(prompt)
if @params[0]
task = task_by_id_or_pt_id(@params[0].to_i) # instead of =@client.get_task_by_id(@params[0].to_i)
else
tasks = @client.get_my_work(@project, @local_config[:user_name])
table = PT::TasksTable.new(tasks)
task = select(prompt, table)
end
task
end
great thinking.