mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
Use new pretty --help.
This commit is contained in:
34
bin/pt-stalk
34
bin/pt-stalk
@@ -85,12 +85,34 @@ usage_or_errors() {
|
||||
echo
|
||||
echo "Command line options:"
|
||||
echo
|
||||
for opt in $(ls "$PO_DIR"); do
|
||||
local desc=$(cat $TMPDIR/po/$opt | grep '^desc:' | sed -e 's/^desc://')
|
||||
echo "--$opt"
|
||||
echo " $desc"
|
||||
echo
|
||||
done
|
||||
perl -e '
|
||||
use strict;
|
||||
use warnings FATAL => qw(all);
|
||||
my $lcol = 20; # Allow this much space for option names.
|
||||
my $rcol = 80 - $lcol; # The terminal is assumed to be 80 chars wide.
|
||||
my $name;
|
||||
while ( <> ) {
|
||||
my $line = $_;
|
||||
chomp $line;
|
||||
if ( $line =~ s/^long:/ --/ ) {
|
||||
$name = $line;
|
||||
}
|
||||
elsif ( $line =~ s/^desc:// ) {
|
||||
$line =~ s/ +$//mg;
|
||||
my @lines = grep { $_ }
|
||||
$line =~ m/(.{0,$rcol})(?:\s+|\Z)/g;
|
||||
if ( length($name) >= $lcol ) {
|
||||
print $name, "\n", (q{ } x $lcol);
|
||||
}
|
||||
else {
|
||||
printf "%-${lcol}s", $name;
|
||||
}
|
||||
print join("\n" . (q{ } x $lcol), @lines);
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
' "$PO_DIR"/*
|
||||
echo
|
||||
echo "Options and values after processing arguments:"
|
||||
echo
|
||||
for opt in $(ls "$PO_DIR"); do
|
||||
|
Reference in New Issue
Block a user