|
4 | 4 | import pyautogui
|
5 | 5 |
|
6 | 6 |
|
7 |
| -def main(rows: int, cols: int, file: str, cast: str, content: str) -> None: |
| 7 | +def main(cols: int, rows: int, file: str, cast: str, content: str) -> None: |
8 | 8 | # Open new tmux window
|
9 | 9 | pyautogui.hotkey("`", "c")
|
10 | 10 | time.sleep(1.0)
|
11 | 11 |
|
12 | 12 | # Start recording demo file
|
13 | 13 | # https://docs.asciinema.org/manual/cli/usage/
|
14 |
| - pyautogui.write("asciinema rec") |
15 |
| - pyautogui.write(f" --rows {rows} --cols {cols}") |
16 |
| - pyautogui.write(f" --command 'nvim {file}' {cast}") |
| 14 | + record_command: list[str] = [ |
| 15 | + "asciinema rec", |
| 16 | + f"--cols {cols} --rows {rows}", |
| 17 | + f"--command 'nvim {file}' {cast}", |
| 18 | + ] |
| 19 | + pyautogui.write(" ".join(record_command)) |
17 | 20 | pyautogui.press("enter")
|
18 | 21 | time.sleep(2.0)
|
19 | 22 |
|
@@ -46,10 +49,10 @@ def main(rows: int, cols: int, file: str, cast: str, content: str) -> None:
|
46 | 49 |
|
47 | 50 | if __name__ == "__main__":
|
48 | 51 | parser = ArgumentParser(description="Generate a demo recording using asciinema")
|
49 |
| - parser.add_argument("--rows", type=int, required=True) |
50 | 52 | parser.add_argument("--cols", type=int, required=True)
|
| 53 | + parser.add_argument("--rows", type=int, required=True) |
51 | 54 | parser.add_argument("--file", type=str, required=True)
|
52 | 55 | parser.add_argument("--cast", type=str, required=True)
|
53 | 56 | parser.add_argument("--content", type=str, required=True)
|
54 | 57 | args = parser.parse_args()
|
55 |
| - main(args.rows, args.cols, args.file, args.cast, args.content) |
| 58 | + main(args.cols, args.rows, args.file, args.cast, args.content) |
0 commit comments