Skip to content

Commit

Permalink
refactor formatting in help messages to produce cleaner man pages
Browse files Browse the repository at this point in the history
compromise between the ideal help message output and ideal man page so that the man pages can be generated
  • Loading branch information
nosracd committed Nov 10, 2024
1 parent 00a478c commit 4bb4358
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 31 deletions.
7 changes: 1 addition & 6 deletions lcm-logger/lcm-logger.1
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,7 @@ that nothing else is changing the target disk,
\fB\-\-disk\-quota\fR=\fI\,10GB\/\fR means that lcm\-logger will not
write more than 5 GB before it exits.
Units accepted: B
1024: K, M, G, T, P, E,
.TP
Ki,
Mi, Gi, Ti, Pi, Ei,
.TP
KiB, MiB, GiB, TiB, PiB, EiB
1024: K, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi, Ei, KiB, MiB, GiB, TiB, PiB, EiB
1000: KB, MB, GB, TB, PB, EB
e.g. "50G" or "0.05 TiB".
Units are treated case insensitively. gb is treated
Expand Down
5 changes: 2 additions & 3 deletions lcm-logger/lcm_logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,8 @@ static void usage()
" --disk-quota=10GB means that lcm-logger will not\n"
" write more than 5 GB before it exits.\n"
" Units accepted: B\n"
" 1024: K, M, G, T, P, E,\n"
" Ki, Mi, Gi, Ti, Pi, Ei,\n"
" KiB, MiB, GiB, TiB, PiB, EiB\n"
" 1024: K, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi, Ei, KiB, "
"MiB, GiB, TiB, PiB, EiB\n"
" 1000: KB, MB, GB, TB, PB, EB\n"
" e.g. \"50G\" or \"0.05 TiB\". \n"
" Units are treated case insensitively. gb is treated\n"
Expand Down
2 changes: 1 addition & 1 deletion lcmgen/getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void getopt_do_usage(getopt_t *gopt)
if (goo->help == NULL || strlen(goo->help) == 0)
printf("\n");
else
printf("\n%*s%s\n\n", leftmargin, "", goo->help);
printf("\n%s\n\n", goo->help);
continue;
}

Expand Down
28 changes: 14 additions & 14 deletions lcmgen/lcm-gen.1
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Java, Python, Lua, and C#.
.TP
\fB\-\-version\fR
[ false ] Show version information and exit
.IP
**** C options ****
.PP
C OPTIONS
.TP
\fB\-c\fR | \fB\-\-c\fR
[ false ] Emit C code
Expand All @@ -61,8 +61,8 @@ Java, Python, Lua, and C#.
.TP
\fB\-\-c\-typeinfo\fR
[ false ] Generate typeinfo functions for each type
.IP
**** C++ options ****
.PP
C++ OPTIONS
.TP
\fB\-x\fR | \fB\-\-cpp\fR
[ false ] Emit C++ code
Expand All @@ -75,8 +75,8 @@ Java, Python, Lua, and C#.
.TP
\fB\-\-cpp\-include\fR
[ ] Generated #include lines reference this folder
.IP
**** Java options ****
.PP
Java OPTIONS
.TP
\fB\-j\fR | \fB\-\-java\fR
[ false ] Emit Java code
Expand All @@ -92,8 +92,8 @@ Java, Python, Lua, and C#.
.TP
\fB\-\-jdefaultpkg\fR
[ lcmtypes ] Default Java package if LCM type has no package
.IP
**** Python options ****
.PP
Python OPTIONS
.TP
\fB\-p\fR | \fB\-\-python\fR
[ false ] Emit Python code
Expand All @@ -103,8 +103,8 @@ Java, Python, Lua, and C#.
.TP
\fB\-\-python\-no\-init\fR
[ false ] Do not create __init__.py
.IP
**** Lua options ****
.PP
Lua OPTIONS
.TP
\fB\-l\fR | \fB\-\-lua\fR
[ false ] Emit Lua code
Expand All @@ -114,8 +114,8 @@ Java, Python, Lua, and C#.
.TP
\fB\-\-lua\-no\-init\fR
[ false ] Do not create init.lua
.IP
**** C#.NET options ****
.PP
C#.NET OPTIONS
.TP
\fB\-\-csharp\fR
[ false ] Emit C#.NET code
Expand All @@ -137,8 +137,8 @@ Java, Python, Lua, and C#.
.TP
\fB\-\-csharp\-default\-nsp\fR
[ LCMTypes ] Default C#.NET namespace if LCM type has no package
.IP
**** Go options ****
.PP
Go OPTIONS
.TP
\fB\-g\fR | \fB\-\-go\fR
[ false ] Emit Go code
Expand Down
14 changes: 7 additions & 7 deletions lcmgen/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,31 @@ int main(int argc, char *argv[])
"Add this package name as a prefix to the declared package");
getopt_add_bool(gopt, 0, "version", 0, "Show version information and exit");

getopt_add_spacer(gopt, "**** C options ****");
getopt_add_spacer(gopt, "C OPTIONS");
getopt_add_bool(gopt, 'c', "c", 0, "Emit C code");
setup_c_options(gopt);

getopt_add_spacer(gopt, "**** C++ options ****");
getopt_add_spacer(gopt, "C++ OPTIONS");
getopt_add_bool(gopt, 'x', "cpp", 0, "Emit C++ code");
setup_cpp_options(gopt);

getopt_add_spacer(gopt, "**** Java options ****");
getopt_add_spacer(gopt, "Java OPTIONS");
getopt_add_bool(gopt, 'j', "java", 0, "Emit Java code");
setup_java_options(gopt);

getopt_add_spacer(gopt, "**** Python options ****");
getopt_add_spacer(gopt, "Python OPTIONS");
getopt_add_bool(gopt, 'p', "python", 0, "Emit Python code");
setup_python_options(gopt);

getopt_add_spacer(gopt, "**** Lua options ****");
getopt_add_spacer(gopt, "Lua OPTIONS");
getopt_add_bool(gopt, 'l', "lua", 0, "Emit Lua code");
setup_lua_options(gopt);

getopt_add_spacer(gopt, "**** C#.NET options ****");
getopt_add_spacer(gopt, "C#.NET OPTIONS");
getopt_add_bool(gopt, 0, "csharp", 0, "Emit C#.NET code");
setup_csharp_options(gopt);

getopt_add_spacer(gopt, "**** Go options ****");
getopt_add_spacer(gopt, "Go OPTIONS");
getopt_add_bool(gopt, 'g', "go", 0, "Emit Go code");
setup_go_options(gopt);
// clang-format on
Expand Down

0 comments on commit 4bb4358

Please sign in to comment.