|
|
@ -14,7 +14,7 @@ col_start = "A" |
|
|
|
row_start = 8 |
|
|
|
row_start = 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def text_to_changelog(raw_text, sheet, start_column, start_row, compact=False): |
|
|
|
def text_to_changelog(raw_text, sheet, start_column, start_row, compact=False, keep=False): |
|
|
|
cells = [line.split("\t") for line in raw_text.splitlines()] |
|
|
|
cells = [line.split("\t") for line in raw_text.splitlines()] |
|
|
|
|
|
|
|
|
|
|
|
xls_sep = "!" if compact else "\t" |
|
|
|
xls_sep = "!" if compact else "\t" |
|
|
@ -31,7 +31,7 @@ def text_to_changelog(raw_text, sheet, start_column, start_row, compact=False): |
|
|
|
current_row = row |
|
|
|
current_row = row |
|
|
|
for column, cell in zip(columns_used, line): |
|
|
|
for column, cell in zip(columns_used, line): |
|
|
|
cell = cell.strip() |
|
|
|
cell = cell.strip() |
|
|
|
if not cell: |
|
|
|
if not (cell or keep): |
|
|
|
continue |
|
|
|
continue |
|
|
|
output.append(f"{sheet}{xls_sep}{column}{row}\t{cell}") |
|
|
|
output.append(f"{sheet}{xls_sep}{column}{row}\t{cell}") |
|
|
|
|
|
|
|
|
|
|
@ -45,9 +45,9 @@ def text_to_changelog(raw_text, sheet, start_column, start_row, compact=False): |
|
|
|
prev = current |
|
|
|
prev = current |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def clipboard_to_changelog(sheet, start_column, start_row, compact=False): |
|
|
|
def clipboard_to_changelog(sheet, start_column, start_row, compact=False, keep=False): |
|
|
|
xls = pyperclip.paste() |
|
|
|
xls = pyperclip.paste() |
|
|
|
result = list(text_to_changelog(xls, sheet, start_column, start_row, compact)) |
|
|
|
result = list(text_to_changelog(xls, sheet, start_column, start_row, compact, keep)) |
|
|
|
line_count = len(result) |
|
|
|
line_count = len(result) |
|
|
|
if line_count == 1: |
|
|
|
if line_count == 1: |
|
|
|
print(f"Copied one line to the clipboard") |
|
|
|
print(f"Copied one line to the clipboard") |
|
|
@ -67,7 +67,8 @@ def clipboard_to_changelog(sheet, start_column, start_row, compact=False): |
|
|
|
@click.option("-s", "--sheet", prompt=True, required=True, default="Input_Data_*") |
|
|
|
@click.option("-s", "--sheet", prompt=True, required=True, default="Input_Data_*") |
|
|
|
@click.option("-w", "--well", prompt=True, required=True, default="A1") |
|
|
|
@click.option("-w", "--well", prompt=True, required=True, default="A1") |
|
|
|
@click.option("-c", "--compact", is_flag=True) |
|
|
|
@click.option("-c", "--compact", is_flag=True) |
|
|
|
def cli(sheet, well, compact): |
|
|
|
@click.option("-k", "--keep", is_flag=True) |
|
|
|
|
|
|
|
def cli(sheet, well, compact, keep): |
|
|
|
regex_well = r"(?P<column>[A-Z]{1,2})(?P<row>\d+)" |
|
|
|
regex_well = r"(?P<column>[A-Z]{1,2})(?P<row>\d+)" |
|
|
|
match = re.match(regex_well, well.upper()) |
|
|
|
match = re.match(regex_well, well.upper()) |
|
|
|
if match is None: |
|
|
|
if match is None: |
|
|
@ -75,4 +76,4 @@ def cli(sheet, well, compact): |
|
|
|
regex_result = match.groupdict() |
|
|
|
regex_result = match.groupdict() |
|
|
|
start_column = regex_result["column"] |
|
|
|
start_column = regex_result["column"] |
|
|
|
start_row = int(regex_result["row"]) |
|
|
|
start_row = int(regex_result["row"]) |
|
|
|
clipboard_to_changelog(sheet, start_column, start_row, compact) |
|
|
|
clipboard_to_changelog(sheet, start_column, start_row, compact, keep) |
|
|
|