Skip to content

Commit 57fa6b9

Browse files
committed
Extract the command line output automatically from scripts
1 parent 56a4cb2 commit 57fa6b9

3 files changed

Lines changed: 10 additions & 72 deletions

File tree

doc/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
'sphinx.ext.intersphinx',
4040
'sphinx.ext.coverage',
4141
'sphinx.ext.viewcode',
42-
'sphinx.ext.graphviz']
42+
'sphinx.ext.graphviz',
43+
'sphinxcontrib.programoutput'
44+
]
4345

4446
# Now, you can use the alias name as a new role, e.g. :issue:`123`.
4547
extlinks = {

doc/doc-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx>=1.8.1
2+
sphinxcontrib-programoutput

doc/scripts.rst

Lines changed: 5 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,89 +8,23 @@ They can be called for example by ``python -m can.logger`` or ``can_logger.py``
88
can.logger
99
----------
1010

11-
Command line help, called with ``--help``::
12-
13-
usage: python -m can.logger [-h] [-f LOG_FILE] [-v] [-c CHANNEL]
14-
[-i {pcan,ixxat,socketcan_ctypes,kvaser,virtual,usb2can,vector,slcan,nican,socketcan,iscan,neovi,serial,socketcan_native}]
15-
[--filter ...] [-b BITRATE]
16-
[--active | --passive]
17-
18-
Log CAN traffic, printing messages to stdout or to a given file.
19-
20-
optional arguments:
21-
-h, --help show this help message and exit
22-
-f LOG_FILE, --file_name LOG_FILE
23-
Path and base log filename, for supported types see
24-
can.Logger.
25-
-v How much information do you want to see at the command
26-
line? You can add several of these e.g., -vv is DEBUG
27-
-c CHANNEL, --channel CHANNEL
28-
Most backend interfaces require some sort of channel.
29-
For example with the serial interface the channel
30-
might be a rfcomm device: "/dev/rfcomm0" With the
31-
socketcan interfaces valid channel examples include:
32-
"can0", "vcan0"
33-
-i {pcan,ixxat,socketcan_ctypes,kvaser,virtual,usb2can,vector,slcan,nican,socketcan,iscan,neovi,serial,socketcan_native}, --interface {pcan,ixxat,socketcan_ctypes,kvaser,virtual,usb2can,vector,slcan,nican,socketcan,iscan,neovi,serial,socketcan_native}
34-
Specify the backend CAN interface to use. If left
35-
blank, fall back to reading from configuration files.
36-
--filter ... Comma separated filters can be specified for the given
37-
CAN interface: <can_id>:<can_mask> (matches when
38-
<received_can_id> & mask == can_id & mask)
39-
<can_id>~<can_mask> (matches when <received_can_id> &
40-
mask != can_id & mask)
41-
-b BITRATE, --bitrate BITRATE
42-
Bitrate to use for the CAN bus.
43-
--active Start the bus as active, this is applied the default.
44-
--passive Start the bus as passive.
11+
Command line help, called with ``--help``:
4512

4613

47-
can.player
48-
----------
49-
50-
Command line help, called with ``--help``::
14+
.. command-output:: python -m can.logger -h
5115

52-
usage: python -m can.player [-h] [-f LOG_FILE] [-v] [-c CHANNEL]
53-
[-i {pcan,ixxat,socketcan_ctypes,kvaser,virtual,usb2can,vector,slcan,nican,socketcan,iscan,neovi,serial,socketcan_native}]
54-
[-b BITRATE] [--ignore-timestamps]
55-
[-g GAP] [-s SKIP]
56-
input-file
5716

58-
Replay CAN traffic.
17+
can.player
18+
----------
5919

60-
positional arguments:
61-
input-file The file to replay. For supported types see
62-
can.LogReader.
20+
.. command-output:: python -m can.player -h
6321

64-
optional arguments:
65-
-h, --help show this help message and exit
66-
-f LOG_FILE, --file_name LOG_FILE
67-
Path and base log filename, for supported types see
68-
can.LogReader.
69-
-v Also print can frames to stdout. You can add several
70-
of these to enable debugging
71-
-c CHANNEL, --channel CHANNEL
72-
Most backend interfaces require some sort of channel.
73-
For example with the serial interface the channel
74-
might be a rfcomm device: "/dev/rfcomm0" With the
75-
socketcan interfaces valid channel examples include:
76-
"can0", "vcan0"
77-
-i {pcan,ixxat,socketcan_ctypes,kvaser,virtual,usb2can,vector,slcan,nican,socketcan,iscan,neovi,serial,socketcan_native}, --interface {pcan,ixxat,socketcan_ctypes,kvaser,virtual,usb2can,vector,slcan,nican,socketcan,iscan,neovi,serial,socketcan_native}
78-
Specify the backend CAN interface to use. If left
79-
blank, fall back to reading from configuration files.
80-
-b BITRATE, --bitrate BITRATE
81-
Bitrate to use for the CAN bus.
82-
--ignore-timestamps Ignore timestamps (send all frames immediately with
83-
minimum gap between frames)
84-
-g GAP, --gap GAP <s> minimum time between replayed frames
85-
-s SKIP, --skip SKIP <s> skip gaps greater than 's' seconds
8622

8723
can.viewer
8824
----------
8925

9026
A screenshot of the application can be seen below:
9127

92-
.. image:: ../images/viewer.png
93-
:width: 100%
9428

9529
The first column is the number of times a frame with the particular ID that has been received, next is the timestamp of the frame relative to the first received message. The third column is the time between the current frame relative to the previous one. Next is the length of the frame, the data and then the decoded data converted according to the ``-d`` argument. The top red row indicates an error frame.
9630

0 commit comments

Comments
 (0)