Skip to content

Instantly share code, notes, and snippets.

@defunkt
Created May 5, 2010 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save defunkt/390432 to your computer and use it in GitHub Desktop.
Save defunkt/390432 to your computer and use it in GitHub Desktop.
rip-readme PACKAGE - Print a package's README
#!/usr/bin/env ruby
# Usage: rip-readme package
#
# Prints the contents of the installed package's README.
require 'rip/script'
target = ARGV[0]
rip(:installed).each do |package_path|
package_path = package_path.chomp
package = metadata(package_path)
if package.name == target
if readme = Dir[package_path + '/*'].grep(/\/readme/i).first
puts File.read(readme)
end
exit 0
end
end
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment