Created
May 5, 2010 06:02
-
-
Save defunkt/390432 to your computer and use it in GitHub Desktop.
rip-readme PACKAGE - Print a package's README
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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