Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 96d9686b83
Fetching contributors…

Cannot retrieve contributors at this time

executable file 49 lines (39 sloc) 1.345 kb
#!/usr/bin/env ruby
require 'thor'
class CuiAboutMeClient < Thor
ROOT_PATH = 'http://cui-about.me'
desc 'me', 'curl http://cui-about.me'
def me
system "curl #{ROOT_PATH}"
end
desc 'users', 'curl http://cui-about.me/users'
def users
system "curl #{ROOT_PATH}/users"
end
desc 'show USERNAME', 'curl http://cui-about.me/USERNAME'
method_option :item, aliases: '-i'
def show(username)
if options[:item]
system "curl #{ROOT_PATH}/#{username}/#{options[:item]}"
else
system "curl #{ROOT_PATH}/#{username}"
end
end
desc 'create USERNAME', "curl -X POST -d 'name=USERNAME' -d 'password=PASSWORD' http://cui-about.me/signup"
method_option :password, aliases: '-p', required: true
def create(username)
system "curl -X POST -d 'name=#{username}' -d 'password=#{options[:password]}' #{ROOT_PATH}/signup"
end
desc 'update USERNAME', "curl -X PUT -d 'password=PASSWORD' [-d 'key=value'] http://cui-about.me/USERNAME"
method_option :password, aliases: '-p', required: true
method_option :items, aliases: '-i', type: :hash, default: {}
def update(username)
cmd = "curl -X PUT -d 'password=#{options[:password]}'"
options[:items].each do |f, v|
cmd << " -d '#{f}=#{v}'"
end
cmd << " #{ROOT_PATH}/#{username}"
system cmd
end
end
CuiAboutMeClient.start
Jump to Line
Something went wrong with that request. Please try again.