Skip to content

Commit 58312fb

Browse files
authored
Merge pull request #197 from fatkodima/fix-cli-banner
Fix printing CLI banner
2 parents 86b9cc6 + f7ba37b commit 58312fb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

bin/stackprof

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
require 'optparse'
33
require 'stackprof'
44

5+
banner = <<-END
6+
Usage: stackprof run [--mode=MODE|--out=FILE|--interval=INTERVAL|--format=FORMAT] -- COMMAND
7+
Usage: stackprof [file.dump]+ [--text|--method=NAME|--callgrind|--graphviz]
8+
END
9+
510
if ARGV.first == "run"
611
ARGV.shift
712
env = {}
8-
parser = OptionParser.new(ARGV) do |o|
9-
o.banner = "Usage: stackprof run [--mode=MODE|--out=FILE|--interval=INTERVAL|--format=FORMAT] -- COMMAND"
10-
o.banner = "Usage: stackprof [file.dump]+ [--text|--method=NAME|--callgrind|--graphviz]"
11-
13+
parser = OptionParser.new(banner) do |o|
1214
o.on('--mode [MODE]', String, 'Mode of sampling: cpu, wall, object, default to wall') do |mode|
1315
env["STACKPROF_MODE"] = mode
1416
end
@@ -37,10 +39,7 @@ if ARGV.first == "run"
3739
else
3840
options = {}
3941

40-
parser = OptionParser.new(ARGV) do |o|
41-
o.banner = "Usage: stackprof run [--mode|--out|--interval] -- COMMAND"
42-
o.banner = "Usage: stackprof [file.dump]+ [--text|--method=NAME|--callgrind|--graphviz]"
43-
42+
parser = OptionParser.new(banner) do |o|
4443
o.on('--text', 'Text summary per method (default)'){ options[:format] = :text }
4544
o.on('--json', 'JSON output (use with web viewers)'){ options[:format] = :json }
4645
o.on('--files', 'List of files'){ |f| options[:format] = :files }

0 commit comments

Comments
 (0)