Class: DTracer::CLI
- Inherits:
-
Thor
- Object
- Thor
- DTracer::CLI
- Defined in:
- lib/dtracer/cli.rb
Instance Method Summary collapse
Instance Method Details
#curl ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dtracer/cli.rb', line 12 def curl say "Starting dtrace", :green t1 = Thread.new do ProbeListener.new("request", true).listen do |hash| puts RequestCurlFormatter.new(hash).to_s end end t2 = Thread.new do sleep(0.3) add_response_probe if [:r] end t1.join t2.join rescue Exception => ex say ex., :red end |
#custom ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/dtracer/cli.rb', line 80 def custom say "Starting dtrace", :green probe = ProbeListener.new("custom", false) probe.listen do |string| puts string end rescue Exception => ex say ex., :red end |
#details ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/dtracer/cli.rb', line 41 def details = .dup .delete(:r) raise "Select any option from -b, -c, -h, -u (you can combine them for more info)" if .empty? say "Starting dtrace", :green t1 = Thread.new do ProbeListener.new("request", true).listen do |hash| puts RequestDetailsFormatter.new(hash, || {}).to_s end end t2 = Thread.new do sleep(0.3) add_response_probe if [:r] end t1.join t2.join rescue Exception => ex say ex., :red end |
#response ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/dtracer/cli.rb', line 69 def response say "Starting dtrace", :green add_response_probe rescue Exception => ex say ex., :red end |