Skip to content

Commit ad5fa8e

Browse files
committed
[docs] improved root command help
1 parent d95bff5 commit ad5fa8e

File tree

3 files changed

+60
-25
lines changed

3 files changed

+60
-25
lines changed

docs/about.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ These have to be set before specifying the command groups.
4040
4141
iman --info --file iman.log measure ...
4242
43-
Usage
44-
-----
43+
.. tip::
4544

46-
.. click:: instrumentman:cli
47-
:prog: iman
45+
See the command help for all logging options.
46+
47+
.. code-block:: shell
48+
49+
iman -h

src/instrumentman/__init__.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,43 @@ def cli(
5353
dateformat: str = "%Y-%m-%d %H:%M:%S",
5454
rotate: tuple[int, int] | None = None
5555
) -> None:
56-
"""Automated measurement programs and related utilities for surveying
57-
instruments."""
56+
"""
57+
\b
58+
+--------------------------------------------------------------------+
59+
| |
60+
| .---------. |
61+
| / +-------+ \\ |
62+
| .__| +---+ |__. |
63+
| | | | | | | ___ |
64+
| | |=| @ |=| | |_ _| _ __ ___ __ _ _ __ |
65+
| | | | | | | | | _____ | '_ ` _ \\ / _` | | '_ \\ |
66+
| | | +---+ | | | | |_____| | | | | | | | (_| | | | | | |
67+
| .+--+-------+--+. |___| |_| |_| |_| \\__,_| |_| |_| |
68+
| | .----. 123 | |
69+
| | |____| 456 | |
70+
| '_______________' |
71+
| |
72+
+--------------------------------------------------------------------+
73+
74+
Instrumentman (or I-man for short) is a collection of command line programs
75+
related to the automation of surveying instruments (primarily robotic total
76+
stations) through serial line command protocols (mainly Leica GeoCom).
77+
78+
The individual commands are available through their respective action
79+
based command groups. The help page for each command can be accessed
80+
through the -h/--help option. Logging can be set up with options of this
81+
root command.
82+
83+
Examples:
84+
85+
iman download file -h
86+
87+
iman --debug --file log.log measure inclination -o incline.csv -p 3 COM1
88+
89+
iman calc sets merged.json results.csv
90+
91+
iman terminal
92+
"""
5893
configure_logging(
5994
protocol,
6095
debug,

src/instrumentman/utils.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def com_port_argument() -> Callable[[F], F]:
6363
return argument(
6464
"port",
6565
help=(
66-
"serial port that the instrument is connected to (must be a valid "
66+
"Serial port that the instrument is connected to (must be a valid "
6767
"identifier like COM1 or /dev/usbtty0)"
6868
),
6969
type=str
@@ -76,7 +76,7 @@ def com_timeout_option(
7676
return option(
7777
"-t",
7878
"--timeout",
79-
help="serial timeout",
79+
help="Serial timeout",
8080
type=IntRange(min=0),
8181
default=default
8282
)
@@ -88,7 +88,7 @@ def com_baud_option(
8888
return option(
8989
"-b",
9090
"--baud",
91-
help="serial speed",
91+
help="Serial speed",
9292
type=Choice(
9393
[
9494
"1200",
@@ -112,19 +112,18 @@ def com_baud_option(
112112
def com_option_group() -> Callable[[F], F]:
113113
return option_group(
114114
"Connection options",
115-
"Options related to the serial connection",
116115
com_baud_option(),
117116
com_timeout_option(),
118117
option(
119118
"-r",
120119
"--retry",
121-
help="number of connection retry attempts",
120+
help="Number of connection retry attempts",
122121
type=IntRange(min=0, max=10),
123122
default=1
124123
),
125124
option(
126125
"--sync-after-timeout",
127-
help="attempt to synchronize message que after a timeout",
126+
help="Attempt to synchronize message que after a timeout",
128127
is_flag=True
129128
)
130129
)
@@ -133,74 +132,73 @@ def com_option_group() -> Callable[[F], F]:
133132
def logging_option_group() -> Callable[[F], F]:
134133
return option_group(
135134
"Logging options",
136-
"Options related to the logging functionalities.",
137135
option(
138136
"--protocol",
139137
help=(
140-
"log debug level messages and above, "
138+
"Log debug level messages and above, "
141139
"including protocol messages"
142140
),
143141
is_flag=True
144142
),
145143
option(
146144
"--debug",
147-
help="log debug level messages and above",
145+
help="Log debug level messages and above",
148146
is_flag=True
149147
),
150148
option(
151149
"--info",
152-
help="log information level messages and above",
150+
help="Log information level messages and above",
153151
is_flag=True
154152
),
155153
option(
156154
"--warning",
157-
help="log warning level messages and above",
155+
help="Log warning level messages and above",
158156
is_flag=True
159157
),
160158
option(
161159
"--error",
162-
help="log error level messages and above",
160+
help="Log error level messages and above",
163161
is_flag=True
164162
),
165163
option(
166164
"--critical",
167-
help="log critical error level messages",
165+
help="Log critical error level messages",
168166
is_flag=True
169167
),
170168
option(
171169
"--file",
172-
help="log to file",
170+
help="Log to file",
173171
type=file_path(readable=False)
174172
),
175173
option(
176174
"--stdout",
177-
help="log to standard output",
175+
help="Log to standard output",
178176
is_flag=True
179177
),
180178
option(
181179
"--stderr",
182-
help="log to standard error",
180+
help="Log to standard error",
183181
is_flag=True
184182
),
185183
option(
186184
"--format",
187185
help=(
188-
"logging format string (as accepted by the `logging` package "
186+
"Logging format string (as accepted by the `logging` package "
189187
"in '{' style)"
190188
),
191189
type=str,
192190
default="{asctime} <{name}> [{levelname}] {message}"
193191
),
194192
option(
195193
"--dateformat",
196-
help="date-time format spec (as accepted by `strftime`)",
194+
help="Date-time format spec (as accepted by `strftime`)",
197195
type=str,
198196
default="%Y-%m-%d %H:%M:%S"
199197
),
200198
option(
201199
"--rotate",
202200
help=(
203-
"number of backup log files to rotate, and maximum size "
201+
"Number of backup log files to rotate, and maximum size "
204202
"(in bytes) of a log file before rotation"
205203
),
206204
type=(IntRange(1), IntRange(1))

0 commit comments

Comments
 (0)