diff options
author | Kyle Blatter <[email protected]> | 2014-11-05 10:08:45 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-01-28 10:59:19 -0800 |
commit | 3bfc7f1b2052a794ffceb6a33f5b21f613a479dc (patch) | |
tree | 21cc2f785aa29213953f5c2bf7f8d15b9b755871 /man/man1/Makefile.am | |
parent | 53dc1139e7de76045b73ff9c72d75b81653b7012 (diff) |
Refactor arc_summary to simplify -p processing
The -p option is used to specify a specific page of output to be
displayed. If omitted, all output pages would be displayed.
arc_summary, as it stood, had really kludgy processing code for
processing the -p option. It relied on a try-except block which was
treated as an if statement and in normal operation would fail any time a
user didn't specify the -p option on the command line. When the
exception was thrown, the script would then display all output pages.
This happened whether the -p option was omitted or malformed. Thus, in
the principle use case, an exception would be raised in order to run the
script as desired. The same except code would be called regardless of
the exception, however, and malformed -p arguments would also cause the
script to execute.
Additionally, this required the function which handles the case where
all output pages were to be displayed, _call_all, to be potentially
called from several locations within main.
This commit refactors the option processing code to simplify it and make
it easier to catch runtime errors in the script. This is done by
specializing the try-except block to only have an exception when the -p
argument is malformed. When the -p option is correctly selected by the
user, it calls a function in the unSub array directly, which will only
display one page of output.
Finally in the context of this refactoring the page breaks have been
removed. Pages seem to have been added into the output in the FreeNAS
version of the script. This patch removes pages from the output to more
closely resemble the freebsd version of the script.
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Kyle Blatter <[email protected]>
Signed-off-by: Ned Bass <[email protected]>
Diffstat (limited to 'man/man1/Makefile.am')
0 files changed, 0 insertions, 0 deletions