tools: Use hyphens instead of underscores for multi-word option names.

Option names like --mach-service are easier to type than --mach_service.
Command-line tools don’t necessarily have the most ergonomic interfaces
anyway, but this is an improvement.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/774763006
This commit is contained in:
Mark Mentovai 2014-12-04 16:46:12 -05:00
parent c83e773c33
commit 22b2f0cad7
8 changed files with 58 additions and 58 deletions

View File

@ -38,7 +38,7 @@ Runs a Mach exception server registered with the bootstrap server under the name
Information about the exception will be appended to 'FILE' instead of the Information about the exception will be appended to 'FILE' instead of the
standard output stream. standard output stream.
*-m*, *--mach_service*='SERVICE':: *-m*, *--mach-service*='SERVICE'::
Check in with the bootstrap server under the name 'SERVICE'. This service name Check in with the bootstrap server under the name 'SERVICE'. This service name
may already be reserved with the bootstrap server in cases where this tool is may already be reserved with the bootstrap server in cases where this tool is
started by launchd(8) as a result of a message being sent to a service declared started by launchd(8) as a result of a message being sent to a service declared
@ -72,11 +72,11 @@ Run a one-shot blocking exception server registered with the bootstrap server
under the name +svc+: under the name +svc+:
[subs="quotes"] [subs="quotes"]
---- ----
$ *catch_exception_tool --mach_service=svc --file=out &* $ *catch_exception_tool --mach-service=svc --file=out &*
[1] 1233 [1] 1233
$ *exception_port_tool --set_handler=handler=bootstrap:svc crasher* $ *exception_port_tool --set-handler=handler=bootstrap:svc crasher*
Illegal instruction: 4 Illegal instruction: 4
[1]+ Done catch_exception_tool --mach_service=svc --file=out [1]+ Done catch_exception_tool --mach-service=svc --file=out
$ *cat out* $ *cat out*
catch_exception_tool: catch_exception_tool:
behavior EXCEPTION_DEFAULT|MACH_EXCEPTION_CODES, behavior EXCEPTION_DEFAULT|MACH_EXCEPTION_CODES,
@ -90,10 +90,10 @@ bootstrap server under the name +svc+:
[subs="quotes"] [subs="quotes"]
---- ----
$ *on_demand_service_tool --load --label=catch_exception \ $ *on_demand_service_tool --load --label=catch_exception \
--mach_service=svc \ --mach-service=svc \
$(which catch_exception_tool) --mach_service=svc \ $(which catch_exception_tool) --mach-service=svc \
--file=/tmp/out --nonblocking --persistent* --file=/tmp/out --nonblocking --persistent*
$ *exception_port_tool --set_handler=handler=bootstrap:svc crasher* $ *exception_port_tool --set-handler=handler=bootstrap:svc crasher*
Illegal instruction: 4 Illegal instruction: 4
$ *on_demand_service_tool --unload --label=catch_exception* $ *on_demand_service_tool --unload --label=catch_exception*
$ *cat /tmp/out* $ *cat /tmp/out*

View File

@ -170,7 +170,7 @@ void Usage(const std::string& me) {
"Catch Mach exceptions and display information about them.\n" "Catch Mach exceptions and display information about them.\n"
"\n" "\n"
" -f, --file=FILE append information to FILE instead of stdout\n" " -f, --file=FILE append information to FILE instead of stdout\n"
" -m, --mach_service=SERVICE register SERVICE with the bootstrap server\n" " -m, --mach-service=SERVICE register SERVICE with the bootstrap server\n"
" -n, --nonblocking don't block waiting for an exception to occur\n" " -n, --nonblocking don't block waiting for an exception to occur\n"
" -p, --persistent continue processing exceptions after the first\n" " -p, --persistent continue processing exceptions after the first\n"
" -t, --timeout=TIMEOUT run for a maximum of TIMEOUT seconds\n" " -t, --timeout=TIMEOUT run for a maximum of TIMEOUT seconds\n"
@ -203,7 +203,7 @@ int CatchExceptionToolMain(int argc, char* argv[]) {
const struct option long_options[] = { const struct option long_options[] = {
{"file", required_argument, nullptr, kOptionFile}, {"file", required_argument, nullptr, kOptionFile},
{"mach_service", required_argument, nullptr, kOptionMachService}, {"mach-service", required_argument, nullptr, kOptionMachService},
{"nonblocking", no_argument, nullptr, kOptionNonblocking}, {"nonblocking", no_argument, nullptr, kOptionNonblocking},
{"persistent", no_argument, nullptr, kOptionPersistent}, {"persistent", no_argument, nullptr, kOptionPersistent},
{"timeout", required_argument, nullptr, kOptionTimeout}, {"timeout", required_argument, nullptr, kOptionTimeout},

View File

@ -28,12 +28,12 @@ exception_port_tool - Show and change Mach exception ports
== Description == Description
Shows Mach exception ports registered for a thread, task, or host target with a Shows Mach exception ports registered for a thread, task, or host target with a
*--show_** option, changes Mach exception ports with *--set_handler*, shows *--show-** option, changes Mach exception ports with *--set-handler*, shows
changes with a *--show_new_** option, and executes 'COMMAND' along with any changes with a *--show-new-** option, and executes 'COMMAND' along with any
arguments specified ('ARG…') with the changed exception ports in effect. arguments specified ('ARG…') with the changed exception ports in effect.
== Options == Options
*-s*, *--set_handler*='DESCRIPTION':: *-s*, *--set-handler*='DESCRIPTION'::
Set an exception port to 'DESCRIPTION'. This option may appear zero, one, or Set an exception port to 'DESCRIPTION'. This option may appear zero, one, or
more times. more times.
+ +
@ -79,15 +79,15 @@ exception port should be cleared. 'HANDLER' may also take the form
and set that service as the exception handler. The default value of 'HANDLER' is and set that service as the exception handler. The default value of 'HANDLER' is
*NULL*. *NULL*.
*--show_bootstrap*='SERVICE':: *--show-bootstrap*='SERVICE'::
Looks up 'SERVICE' with the bootstrap server and shows it. Normally, the handler Looks up 'SERVICE' with the bootstrap server and shows it. Normally, the handler
port values displayed by the other *--show_** options are meaningless port values displayed by the other *--show-** options are meaningless
handles, but by comparing them to the port values for known bootstrap services, handles, but by comparing them to the port values for known bootstrap services,
it is possible to verify that they are set as intended. it is possible to verify that they are set as intended.
*-p*, *--pid*='PID':: *-p*, *--pid*='PID'::
For operations on the task target, including *--set_handler* with 'TARGET' set For operations on the task target, including *--set-handler* with 'TARGET' set
to *task*, *--show_task*, and *--show_new_task*, operates on the task associated to *task*, *--show-task*, and *--show-new-task*, operates on the task associated
with process id 'PID' instead of the current task associated with the tool. When with process id 'PID' instead of the current task associated with the tool. When
this option is supplied, 'COMMAND' must not be specified. this option is supplied, 'COMMAND' must not be specified.
+ +
@ -97,32 +97,32 @@ taskgated(8). Consequently, this program must normally be invoked by root to use
this option. It is possible to install this program as a setuid root executable this option. It is possible to install this program as a setuid root executable
to overcome this limitation. to overcome this limitation.
*-h*, *--show_host*:: *-h*, *--show-host*::
Shows the original host exception ports before making any changes requested by Shows the original host exception ports before making any changes requested by
*--set_handler*. This option is restricted to the superuser. *--set-handler*. This option is restricted to the superuser.
*-t*, *--show_task*:: *-t*, *--show-task*::
Shows the original task exception ports before making any changes requested by Shows the original task exception ports before making any changes requested by
*--set_handler*. *--set-handler*.
*--show_thread*:: *--show-thread*::
Shows the original thread exception ports before making any changes requested by Shows the original thread exception ports before making any changes requested by
*--set_handler*. *--set-handler*.
*-H*, *--show_new_host*:: *-H*, *--show-new-host*::
Shows the modified host exception ports after making any changes requested by Shows the modified host exception ports after making any changes requested by
*--set_handler*. This option is restricted to the superuser. *--set-handler*. This option is restricted to the superuser.
*-T*, *--show_new_task*:: *-T*, *--show-new-task*::
Shows the modified task exception ports after making any changes requested by Shows the modified task exception ports after making any changes requested by
*--set_handler*. *--set-handler*.
*--show_new_thread*:: *--show-new-thread*::
Shows the modified thread exception ports after making any changes requested by Shows the modified thread exception ports after making any changes requested by
*--set_handler*. *--set-handler*.
*-n*, *--numeric*:: *-n*, *--numeric*::
For *--show_** options, all values will be displayed numerically only. The For *--show-** options, all values will be displayed numerically only. The
default is to decode numeric values and display them symbolically as well. default is to decode numeric values and display them symbolically as well.
*--help*:: *--help*::
@ -140,9 +140,9 @@ are verified by their service names as registered with the bootstrap server.
With the new task-level exception ports in effect, a program is run. With the new task-level exception ports in effect, a program is run.
[subs="quotes"] [subs="quotes"]
---- ----
$ *exception_port_tool --show_task --show_new_task \ $ *exception_port_tool --show-task --show-new-task \
--show_bootstrap=com.apple.ReportCrash --show_bootstrap=svc \ --show-bootstrap=com.apple.ReportCrash --show-bootstrap=svc \
--set_handler=behavior=DEFAULT,handler=bootstrap:svc crash* --set-handler=behavior=DEFAULT,handler=bootstrap:svc crash*
service com.apple.ReportCrash 0xe03 service com.apple.ReportCrash 0xe03
service svc 0x1003 service svc 0x1003
task exception port 0, mask 0x400 (CRASH), port 0xe03, task exception port 0, mask 0x400 (CRASH), port 0xe03,
@ -156,7 +156,7 @@ Shows the task-level exception ports for the process with PID 1234. This
requires superuser permissions or the approval of taskgated(8). requires superuser permissions or the approval of taskgated(8).
[subs="quotes"] [subs="quotes"]
---- ----
# *exception_port_tool --pid=1234 --show_task* # *exception_port_tool --pid=1234 --show-task*
task exception port 0, mask 0x4e task exception port 0, mask 0x4e
(BAD_ACCESS|BAD_INSTRUCTION|ARITHMETIC|BREAKPOINT), port 0x1503, (BAD_ACCESS|BAD_INSTRUCTION|ARITHMETIC|BREAKPOINT), port 0x1503,
behavior 0x1 (DEFAULT), flavor 13 (NONE) behavior 0x1 (DEFAULT), flavor 13 (NONE)

View File

@ -317,16 +317,16 @@ void Usage(const std::string& me) {
"Usage: %s [OPTION]... [COMMAND [ARG]...]\n" "Usage: %s [OPTION]... [COMMAND [ARG]...]\n"
"View and change Mach exception ports, and run COMMAND if supplied.\n" "View and change Mach exception ports, and run COMMAND if supplied.\n"
"\n" "\n"
" -s, --set_handler=DESCRIPTION set an exception port to DESCRIPTION, see below\n" " -s, --set-handler=DESCRIPTION set an exception port to DESCRIPTION, see below\n"
" --show_bootstrap=SERVICE look up and display a service registered with\n" " --show-bootstrap=SERVICE look up and display a service registered with\n"
" the bootstrap server\n" " the bootstrap server\n"
" -p, --pid=PID operate on PID instead of the current task\n" " -p, --pid=PID operate on PID instead of the current task\n"
" -h, --show_host display original host exception ports\n" " -h, --show-host display original host exception ports\n"
" -t, --show_task display original task exception ports\n" " -t, --show-task display original task exception ports\n"
" --show_thread display original thread exception ports\n" " --show-thread display original thread exception ports\n"
" -H, --show_new_host display modified host exception ports\n" " -H, --show-new-host display modified host exception ports\n"
" -T, --show_new_task display modified task exception ports\n" " -T, --show-new-task display modified task exception ports\n"
" --show_new_thread display modified thread exception ports\n" " --show-new-thread display modified thread exception ports\n"
" -n, --numeric display values numerically, not symbolically\n" " -n, --numeric display values numerically, not symbolically\n"
" --help display this help and exit\n" " --help display this help and exit\n"
" --version output version information and exit\n" " --version output version information and exit\n"
@ -403,15 +403,15 @@ int ExceptionPortToolMain(int argc, char* argv[]) {
} options = {}; } options = {};
const struct option long_options[] = { const struct option long_options[] = {
{"set_handler", required_argument, nullptr, kOptionSetPort}, {"set-handler", required_argument, nullptr, kOptionSetPort},
{"show_bootstrap", required_argument, nullptr, kOptionShowBootstrap}, {"show-bootstrap", required_argument, nullptr, kOptionShowBootstrap},
{"pid", required_argument, nullptr, kOptionPid}, {"pid", required_argument, nullptr, kOptionPid},
{"show_host", no_argument, nullptr, kOptionShowHost}, {"show-host", no_argument, nullptr, kOptionShowHost},
{"show_task", no_argument, nullptr, kOptionShowTask}, {"show-task", no_argument, nullptr, kOptionShowTask},
{"show_thread", no_argument, nullptr, kOptionShowThread}, {"show-thread", no_argument, nullptr, kOptionShowThread},
{"show_new_host", no_argument, nullptr, kOptionShowNewHost}, {"show-new-host", no_argument, nullptr, kOptionShowNewHost},
{"show_new_task", no_argument, nullptr, kOptionShowNewTask}, {"show-new-task", no_argument, nullptr, kOptionShowNewTask},
{"show_new_thread", no_argument, nullptr, kOptionShowNewThread}, {"show-new-thread", no_argument, nullptr, kOptionShowNewThread},
{"numeric", no_argument, nullptr, kOptionNumeric}, {"numeric", no_argument, nullptr, kOptionNumeric},
{"help", no_argument, nullptr, kOptionHelp}, {"help", no_argument, nullptr, kOptionHelp},
{"version", no_argument, nullptr, kOptionVersion}, {"version", no_argument, nullptr, kOptionVersion},

View File

@ -50,7 +50,7 @@ systems.
== Options == Options
*-r*, *--no_suspend*:: *-r*, *--no-suspend*::
The target process will continue running while the minidump file is generated. The target process will continue running while the minidump file is generated.
Normally, the target process is suspended during this operation, which Normally, the target process is suspended during this operation, which
guarantees that the minidump file will contain an atomic snapshot of the guarantees that the minidump file will contain an atomic snapshot of the

View File

@ -49,7 +49,7 @@ void Usage(const std::string& me) {
"Usage: %s [OPTION]... PID\n" "Usage: %s [OPTION]... PID\n"
"Generate a minidump file containing a snapshot of a running process.\n" "Generate a minidump file containing a snapshot of a running process.\n"
"\n" "\n"
" -r, --no_suspend don't suspend the target process during dump generation\n" " -r, --no-suspend don't suspend the target process during dump generation\n"
" -o, --output=FILE write the minidump to FILE instead of minidump.PID\n" " -o, --output=FILE write the minidump to FILE instead of minidump.PID\n"
" --help display this help and exit\n" " --help display this help and exit\n"
" --version output version information and exit\n", " --version output version information and exit\n",
@ -77,7 +77,7 @@ int GenerateDumpMain(int argc, char* argv[]) {
options.suspend = true; options.suspend = true;
const struct option long_options[] = { const struct option long_options[] = {
{"no_suspend", no_argument, nullptr, kOptionNoSuspend}, {"no-suspend", no_argument, nullptr, kOptionNoSuspend},
{"output", required_argument, nullptr, kOptionOutput}, {"output", required_argument, nullptr, kOptionOutput},
{"help", no_argument, nullptr, kOptionHelp}, {"help", no_argument, nullptr, kOptionHelp},
{"version", no_argument, nullptr, kOptionVersion}, {"version", no_argument, nullptr, kOptionVersion},

View File

@ -31,7 +31,7 @@ launchd(8)
On-demand services may be registered with launchd(8) by using the *--load* form. On-demand services may be registered with launchd(8) by using the *--load* form.
One or more service names may be registered with the bootstrap server by One or more service names may be registered with the bootstrap server by
specifying *--mach_service*. When a Mach message is sent to any of these specifying *--mach-service*. When a Mach message is sent to any of these
services, launchd(8) will invoke 'COMMAND' along with any arguments specified services, launchd(8) will invoke 'COMMAND' along with any arguments specified
('ARG…'). 'COMMAND' must be an absolute pathname. ('ARG…'). 'COMMAND' must be an absolute pathname.
@ -51,7 +51,7 @@ may also be referred to as “unload” or “remove”.
'LABEL' is used as the job label to identify the job to launchd(8). 'LABEL' must 'LABEL' is used as the job label to identify the job to launchd(8). 'LABEL' must
be unique within a launchd(8) context. be unique within a launchd(8) context.
*-m*, *--mach_service*='SERVICE':: *-m*, *--mach-service*='SERVICE'::
In conjunction with *--load*, registers 'SERVICE' with the bootstrap server. In conjunction with *--load*, registers 'SERVICE' with the bootstrap server.
Clients will be able to obtain a send right by looking up the 'SERVICE' name Clients will be able to obtain a send right by looking up the 'SERVICE' name
with the bootstrap server. When a message is sent to such a Mach port, with the bootstrap server. When a message is sent to such a Mach port,
@ -74,8 +74,8 @@ looking up the name +svc+:
[subs="quotes"] [subs="quotes"]
---- ----
$ *on_demand_service_tool --load --label=catch_exception \ $ *on_demand_service_tool --load --label=catch_exception \
--mach_service=svc \ --mach-service=svc \
$(which catch_exception_tool) --mach_service=svc \ $(which catch_exception_tool) --mach-service=svc \
--file=/tmp/out --nonblocking --persistent* --file=/tmp/out --nonblocking --persistent*
---- ----

View File

@ -43,7 +43,7 @@ void Usage(const std::string& me) {
" COMMAND must be specified\n" " COMMAND must be specified\n"
" -U, --unload unload (remove) the job identified by --label\n" " -U, --unload unload (remove) the job identified by --label\n"
" -l, --label=LABEL identify the job to launchd with LABEL\n" " -l, --label=LABEL identify the job to launchd with LABEL\n"
" -m, --mach_service=SERVICE register SERVICE with the bootstrap server\n" " -m, --mach-service=SERVICE register SERVICE with the bootstrap server\n"
" --help display this help and exit\n" " --help display this help and exit\n"
" --version output version information and exit\n", " --version output version information and exit\n",
me.c_str(), me.c_str(),
@ -85,7 +85,7 @@ int OnDemandServiceToolMain(int argc, char* argv[]) {
{"load", no_argument, nullptr, kOptionLoadJob}, {"load", no_argument, nullptr, kOptionLoadJob},
{"unload", no_argument, nullptr, kOptionUnloadJob}, {"unload", no_argument, nullptr, kOptionUnloadJob},
{"label", required_argument, nullptr, kOptionJobLabel}, {"label", required_argument, nullptr, kOptionJobLabel},
{"mach_service", required_argument, nullptr, kOptionMachService}, {"mach-service", required_argument, nullptr, kOptionMachService},
{"help", no_argument, nullptr, kOptionHelp}, {"help", no_argument, nullptr, kOptionHelp},
{"version", no_argument, nullptr, kOptionVersion}, {"version", no_argument, nullptr, kOptionVersion},
{nullptr, 0, nullptr, 0}, {nullptr, 0, nullptr, 0},