Command-line interface for notebook management
()
| 306 | |
| 307 | |
| 308 | def main(): |
| 309 | """Command-line interface for notebook management""" |
| 310 | parser = argparse.ArgumentParser(description='Manage NotebookLM library') |
| 311 | |
| 312 | subparsers = parser.add_subparsers(dest='command', help='Commands') |
| 313 | |
| 314 | # Add command |
| 315 | add_parser = subparsers.add_parser('add', help='Add a notebook') |
| 316 | add_parser.add_argument('--url', required=True, help='NotebookLM URL') |
| 317 | add_parser.add_argument('--name', required=True, help='Display name') |
| 318 | add_parser.add_argument('--description', required=True, help='Description') |
| 319 | add_parser.add_argument('--topics', required=True, help='Comma-separated topics') |
| 320 | add_parser.add_argument('--use-cases', help='Comma-separated use cases') |
| 321 | add_parser.add_argument('--tags', help='Comma-separated tags') |
| 322 | |
| 323 | # List command |
| 324 | subparsers.add_parser('list', help='List all notebooks') |
| 325 | |
| 326 | # Search command |
| 327 | search_parser = subparsers.add_parser('search', help='Search notebooks') |
| 328 | search_parser.add_argument('--query', required=True, help='Search query') |
| 329 | |
| 330 | # Activate command |
| 331 | activate_parser = subparsers.add_parser('activate', help='Set active notebook') |
| 332 | activate_parser.add_argument('--id', required=True, help='Notebook ID') |
| 333 | |
| 334 | # Remove command |
| 335 | remove_parser = subparsers.add_parser('remove', help='Remove a notebook') |
| 336 | remove_parser.add_argument('--id', required=True, help='Notebook ID') |
| 337 | |
| 338 | # Stats command |
| 339 | subparsers.add_parser('stats', help='Show library statistics') |
| 340 | |
| 341 | args = parser.parse_args() |
| 342 | |
| 343 | # Initialize library |
| 344 | library = NotebookLibrary() |
| 345 | |
| 346 | # Execute command |
| 347 | if args.command == 'add': |
| 348 | topics = [t.strip() for t in args.topics.split(',')] |
| 349 | use_cases = [u.strip() for u in args.use_cases.split(',')] if args.use_cases else None |
| 350 | tags = [t.strip() for t in args.tags.split(',')] if args.tags else None |
| 351 | |
| 352 | notebook = library.add_notebook( |
| 353 | url=args.url, |
| 354 | name=args.name, |
| 355 | description=args.description, |
| 356 | topics=topics, |
| 357 | use_cases=use_cases, |
| 358 | tags=tags |
| 359 | ) |
| 360 | print(json.dumps(notebook, indent=2)) |
| 361 | |
| 362 | elif args.command == 'list': |
| 363 | notebooks = library.list_notebooks() |
| 364 | if notebooks: |
| 365 | print("\n📚 Notebook Library:") |
no test coverage detected