Permalink
Browse files

Add documentation for opening multiple urls

  • Loading branch information...
1 parent 9addd4a commit 4454bf778ccf3b86b89af297873bc7b4d89c6883 @oscardelben committed May 1, 2012
Showing with 11 additions and 7 deletions.
  1. +7 −2 README.md
  2. +4 −5 lib/sheet/open.rb
View
@@ -36,8 +36,13 @@ automatically open a url when opening your sheet:
url: http://example/com
```
-Make sure that's you don't have trailing lines and sheet will
-automatically open that url for you
+You can open mulitple urls at once by specifying each url in a new line.
+
+```yaml
+
+url: https://github.com/oscardelben
+url: http://example.com
+```
Please note that to open urls, sheet will use the `open` command on mac
os x and `xdg-open` in linux. Patches welcome for other systems.
View
@@ -20,9 +20,8 @@ def open
def process_sheet_content
if !sheet_urls.empty? && cmd = Sheet.open_command
- # TODO: check if open is available
sheet_urls.each do |url|
- Sheet.exec "#{cmd} #{url.chomp.gsub(/url: /,'')}"
+ Sheet.exec "#{cmd} #{url.chomp.sub(/url: /,'')}"
end
else
Sheet.write sheet_content
@@ -32,10 +31,10 @@ def process_sheet_content
def sheet_content
@sheet_content ||= File.read(Sheet.sheet_path(name))
end
-
+
def sheet_urls
@sheet_urls ||= sheet_content.split("\n").reject {|line| line !~ /^url:/ }
- end
-
+ end
+
end
end

0 comments on commit 4454bf7

Please sign in to comment.