Class: Chimps::Commands::Help
Constant Summary
collapse
- USAGE =
"usage: chimps help [OPTIONS] [COMMAND]"
- HELP =
"This is the Infochimps command-line client. You can use it to search,\nbrowse, create, edit, or delete data and metadata in the Infochimps\nrepository at http://www.infochimps.com.\n\nBefore you can create, edit, or delete anything you'll need to get an\nInfochimps account at http://www.infochimps.org/signup. You'll\nautomatically be granted an API key.\n\nBut you can still browse, search, and download (free) data\nimmediately.\n\nLearn more about the Infochimps API which powers this tool at\n\n http://www.infochimps.com/apis\n\n= Commands\n\nchimps is a wrapper over the RESTful Infochimps API. It exposes the\nfollowing core actions\n\n $ chimps list\n $ chimps show\n $ chimps create\n $ chimps update\n $ chimps destroy\n\nfor datasets (as well as other selected resources). It also helps\nautomate the workflow of uploading and downloading data with\n\n $ chimps upload\n $ chimps download\n\nYou can also make queries against the Infochimps Query API with\n\n $ chimps query\n\nlearn more about the Infochimps Query API at\nhttp://www.infochimps.com/api.\n\nFinally, you can test that your system is configured properly and that\nyou can authenticate with Infochimps with\n\n $ chimps test\n\nGet more help on a specific command with\n\n $ chimps help COMMAND\n\nfor any of the commands above.\n\n= Setup\n\nOnce you have obtained an API key and secret from Infochimps, place\nthem in a file \#{Chimps.config[:config]} in your home directory\nwith the following format\n\n ---\n # in \#{Chimps.config[:config]}\n\n # API credentials for use with the Infochimps Dataset API\n :site:\n :key: oreeph6giedaeL3\n :secret: Queechei6cu8chiuyiig8cheg5Ahx0boolaizi1ohtarooFu1doo5ohj5ohp9eehae5hakoongahghohgoi7yeihohx1eidaeng0eaveefohchoh6WeeV1EM\n\n # API credentials for use on the Infochimps Query API\n :query:\n :key: zei7eeloShoah3Ce\n"
Instance Attribute Summary
#config
Instance Method Summary
collapse
#initialize, name, #name
Instance Method Details
#command ⇒ Object
81
82
83
|
# File 'lib/chimps-cli/commands/help.rb', line 81
def command
@command ||= Chimps::Commands.class_for(command_name).new(Chimps.config.commands[command_name][:config])
end
|
#command_name ⇒ Object
77
78
79
|
# File 'lib/chimps-cli/commands/help.rb', line 77
def command_name
config.argv[1]
end
|
#execute! ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/chimps-cli/commands/help.rb', line 85
def execute!
if config.argv.size > 1 && Chimps.config.command?(command_name)
$stderr.puts command.class::USAGE
$stderr.puts command.class::HELP
command.config.dump_basic_help "Additional options accepted by all commands:"
else
$stderr.puts self.class::USAGE
$stderr.puts self.class::HELP
end
Chimps.config.dump_basic_help
end
|