From ea8c0c0b4a2339977b79cdeffaa0f870b616dab8 Mon Sep 17 00:00:00 2001 From: Adam Sanderson Date: Wed, 10 Nov 2010 19:38:20 -0800 Subject: [PATCH] Pretty print known paths --- bin/qw | 13 +++++++++++++ lib/qwandry/repository.rb | 1 + 2 files changed, 14 insertions(+) diff --git a/bin/qw b/bin/qw index 55e9378..8b832a6 100755 --- a/bin/qw +++ b/bin/qw @@ -20,6 +20,19 @@ opts = OptionParser.new do |opts| @editor = editor end + opts.separator "Additional Commands" + + opts.on("--paths", "Prints all repositories and their paths") do |editor| + @qwandry.repositories.each do |label, entries| + puts label + entries.each do |repo| + puts "\t#{repo.path} (#{repo.class.to_s.split('::').last})" + end + puts "" + end + exit(0) + end + opts.on_tail("-h", "--help", "Show this message") do puts opts exit diff --git a/lib/qwandry/repository.rb b/lib/qwandry/repository.rb index 4a8a82f..7ac9f87 100644 --- a/lib/qwandry/repository.rb +++ b/lib/qwandry/repository.rb @@ -1,6 +1,7 @@ module Qwandry class Repository attr_reader :name + attr_reader :path def initialize(name, path) @name = name