ADD list command to CLI for displaying all markers

This commit is contained in:
2025-12-18 20:17:54 +00:00
parent 3c870c7a69
commit 143f4e0c8d
2 changed files with 41 additions and 17 deletions

View File

@@ -1,7 +1,28 @@
#!/usr/bin/env python3
import sys
import argparse
from rewind.core import clip, mark
from rewind.core import clip, mark, print_markers
def build_save_parser(subparsers: argparse._SubParsersAction) -> None:
save_parser = subparsers.add_parser("save", help="Save a section from the current recording")
save_parser.add_argument(
"-s", "--seconds",
type=int,
default=30,
help="Number of seconds to include in the clip (default: 30)"
)
def build_mark_parser(subparsers: argparse._SubParsersAction) -> None:
mark_parser = subparsers.add_parser("mark", help="Mark the current time in the recording for later reference")
mark_parser.add_argument(
"-n", "--name",
type=str,
required=True,
help="Name of the marker"
)
def build_list_parser(subparsers: argparse._SubParsersAction) -> None:
list_parser = subparsers.add_parser("list", help="List all markers in the recording")
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
@@ -11,21 +32,9 @@ def build_parser() -> argparse.ArgumentParser:
sub = parser.add_subparsers(dest="command", required=True)
save = sub.add_parser("save", help="Save a section from the current recording")
save.add_argument(
"-s", "--seconds",
type=int,
default=30,
help="Number of seconds to include in the clip (default: 30)"
)
mark = sub.add_parser("mark", help="Mark the current time in the recording for later reference")
mark.add_argument(
"-n", "--name",
type=str,
required=True,
help="Name of the marker"
)
build_save_parser(sub)
build_mark_parser(sub)
build_list_parser(sub)
return parser
@@ -37,6 +46,8 @@ def main(argv=None) -> int:
clip(args.seconds)
elif args.command == "mark":
mark(args.name)
elif args.command == "list":
print_markers()
else:
parser.error("Unknown command")