Sha256: 1640343cc29df7f712321c79c5e5f2172dbae24c1f3ebd4b3d3d66b2d21cbe93
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
module Relish module Command class Collab < Base desc 'list the collaborators for a project' command :default do puts format(resource[resource_path].get(:accept => :json)) end usage 'collab:add <org_or_user_handle>/<project_handle>:' + '<collaborator_handle_or_email>' desc ['add a collaborator to a project', 'example: relish collab:add rspec/rspec-core:justin'].join("\n") command :add do puts resource[resource_path].post(:handle_or_email => handle_or_email) end usage 'collab:remove <org_or_user_handle>/<project_handle>:' + '<collaborator_handle_or_email>' desc ['remove a collaborator from a project', 'example: relish collab:remove rspec/rspec-core:justin'].join("\n") command :remove do puts resource["#{resource_path}/#{handle_or_email}"].delete end private def resource_path "projects/#{@param.remove_option}/memberships" end def handle_or_email @param.extract_option end def format(response) json_parse(response) do |hash| "#{hash['user']['handle']} (#{hash['user']['email']})" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relish-0.1.0 | lib/relish/commands/collab.rb |