Class: Fropy::CLI
- Inherits:
-
Object
- Object
- Fropy::CLI
- Defined in:
- lib/fropy/cli.rb
Constant Summary collapse
- Doc =
"Fropy - Process memory and cpu time benchmarker\n\nUsage:\n fropy <command> [--dev-null] [--poll-interval=POLL]\n fropy -h | --help\n fropy -v | --version\n\nOptions:\n -h --help Show this help\n --dev-null Redirect output of the command to /dev/null\n --poll-interval=POLL Time in seconds to poll memory usage and process\n status [default: 0.05]\n"
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(argv) ⇒ CLI
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fropy/cli.rb', line 18 def initialize(argv) require "pp" begin = Docopt::docopt(Doc) if ["-v"] || ["--version"] puts "Fropy #{Fropy::VERSION}" exit end benchmark = Benchmark.new ["<command>"], poll_interval: ["--poll-interval"].to_f, dev_null: ["--dev-null"] benchmark.measure rescue Docopt::Exit => e puts e. end end |