lib/pt/ui.rb in pt-0.5.1 vs lib/pt/ui.rb in pt-0.5.2

- old
+ new

@@ -43,13 +43,13 @@ end def create if @params[0] name = @params[0] - owner = find_owner @params[1] + owner = find_owner(@params[1]) || find_owner(@params[2]) || @local_config[:user_name] requester = @local_config[:user_name] - task_type = @params[2] || 'feature' + task_type = task_type_or_nil(@params[1]) || task_type_or_nil(@params[2]) || 'feature' else title("Let's create a new task:") name = ask("Name for the new task:") end @@ -364,11 +364,11 @@ message("You need to provide a substring for a tasks title.") end end def updates - activities = @client.get_activities(@project) + activities = @client.get_activities(@project, @params[0]) tasks = @client.get_my_work(@project, @local_config[:user_name]) title("Recent Activity on #{project_to_s}") activities.each do |activity| show_activity(activity, tasks) end @@ -394,11 +394,11 @@ message("pt accept [id] # mark a task as accepted") message("pt reject [id] [reason] # mark a task as rejected, explaining why") message("pt find [query] # looks in your tasks by title and presents it") message("pt done [id] ~[0-3] ~[comment] # lazy mans finish task, does everything") message("pt list [member] # list all tasks for another pt user") - message("pt updates # show recent activity from your current project") + message("pt updates [number] # shows number recent activity from your current project") message("") message("All commands can be ran without arguments for a wizard like UI.") end protected @@ -517,10 +517,17 @@ end def project_to_s "Project #{@local_config[:project_name].upcase}" end + + def task_type_or_nil query + if (["feature", "bug", "chore"].index query) + return query + end + nil + end def find_task query members = @client.get_members(@project) members.each do | member | if member.name.downcase.index query @@ -541,9 +548,12 @@ def find_owner query members = @client.get_members(@project) members.each do | member | if member.name.downcase.index query + return member + end + if member.initials.downcase.index query return member end end nil end