Skip to content

Commit a599642

Browse files
committed
[datatransfer] added header skip option to upload
1 parent 7133704 commit a599642

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/instrumentman/datatransfer/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
extra_command,
55
argument,
66
option,
7+
IntRange,
78
File
89
)
910

@@ -59,6 +60,13 @@ def cli_download(**kwargs: Any) -> None:
5960
)
6061
@com_baud_option(1200)
6162
@com_timeout_option()
63+
@option(
64+
"-s",
65+
"--skip",
66+
help="number of header rows to skip",
67+
type=IntRange(min=0),
68+
default=0
69+
)
6270
def cli_upload(**kwargs: Any) -> None:
6371
"""Upload ASCII data to the instrument."""
6472
from .app import main_upload

src/instrumentman/datatransfer/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,18 @@ def main_upload(
5050
port: str,
5151
file: TextIOWrapper,
5252
baud: int = 1200,
53-
timeout: int = 15
53+
timeout: int = 15,
54+
skip: int = 0
5455
) -> None:
5556
with open_serial(
5657
port,
5758
speed=baud,
5859
timeout=timeout
5960
) as com:
6061
try:
62+
for _ in range(skip):
63+
next(file)
64+
6165
count = 0
6266
with progressbar(
6367
file,

0 commit comments

Comments
 (0)