Skip to content
Browse files

Update the README

  • Loading branch information...
1 parent 44332c4 commit 6fb2bf15af248f4fee5e0ac783ebdef5030b7f9c @jyurek jyurek committed Aug 17, 2011
Showing with 25 additions and 1 deletion.
  1. +25 −1 README.md
View
26 README.md
@@ -75,7 +75,17 @@ But don't fear, you can specify where to look for the command.
```ruby
Cocaine::CommandLine.path = "/opt/bin"
line = Cocaine::CommandLine.new("lolwut")
-line.command # => "/opt/bin/lolwut"
+line.command # => "lolwut", but it looks in /opt/bin for it.
+```
+
+You can even give it a bunch of places to look.
+
+```ruby
+FileUtils.rm("/opt/bin/lolwut")
+`echo 'echo Hello' > /usr/local/bin/lolwut`
+Cocaine::CommandLine.path = ["/opt/bin", "/usr/local/bin"]
+line = Cocaine::CommandLine.new("lolwut")
+line.run # => prints 'Hello', because it searches the path
```
Or, just, you know, put it in the command.
@@ -96,6 +106,20 @@ rescue Cocaine::ExitStatusError => e
end
```
+You can see what's getting run. The 'Command' part it logs is in green for visibility!
+
+```ruby
+line = Cocaine::CommandLine.new("echo", ":var", :var => "LOL!", :logger => Logger.new(STDOUT))
+line.run # => Logs this with #info -> Command :: echo 'LOL!'
+```
+
+But you don't have to, as you saw above where it doesn't use this. But you CAN log every command!
+
+```ruby
+Cocaine::CommandLine.logger = Logger.new(STDOUT)
+Cocaine::CommandLine.new("date").run # => Logs this -> Command :: date
+```
+
## License
Copyright 2011 Jon Yurek and thoughtbot, inc. This is free software, and may be redistributed under the terms specified in the LICENSE file.

0 comments on commit 6fb2bf1

Please sign in to comment.
Something went wrong with that request. Please try again.