Sha256: ee3ad487b747aa0f6b5ee44d794490c1cd9e4f5809f039581531a9cf3c89f67d
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require 'rubygems' require 'json' module Relish module Command class Projects < Base desc 'list your projects' command :default => :list usage 'projects:list' desc 'list your projects' command :list do response = resource['projects'].get(:accept => :json) puts format(response) end usage 'projects:add <org_or_user_handle>/<project_handle>' desc 'add a project' command :add do puts resource['projects'].post(:handle => @param) end usage 'projects:remove <org_or_user_handle>/<project_handle>' desc 'remove a project' command :remove do puts resource["projects/#{@param}"].delete end private def format(response) json = JSON.parse(response) json.map do |hash| result = hash['project']['full_handle'] result << " (private)" if hash['project']['private'] result end.join("\n") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relish-0.0.9 | lib/relish/commands/projects.rb |