()
| 797 | |
| 798 | # CLI fallback add |
| 799 | def add_note_interactive(): |
| 800 | notes = load_notes() |
| 801 | print('\n=== Add Note ===') |
| 802 | name = input('Note name: ').strip() |
| 803 | if not name: |
| 804 | print('Canceled: empty name') |
| 805 | return |
| 806 | if name in notes: |
| 807 | if input('Overwrite existing? (y/N): ').lower() not in ('y'): |
| 808 | print('Canceled') |
| 809 | return |
| 810 | print('Starting editor. Terminate with a line containing only .save') |
| 811 | try: |
| 812 | lines = [] |
| 813 | while True: |
| 814 | ln = input() |
| 815 | if ln.strip() == '.save': |
| 816 | break |
| 817 | lines.append(ln) |
| 818 | new = '\n'.join(lines) |
| 819 | except KeyboardInterrupt: |
| 820 | print('\nCanceled') |
| 821 | return |
| 822 | notes[name] = new |
| 823 | save_notes(notes) |
| 824 | print('Saved.') |
| 825 | |
| 826 | # Help |
| 827 | def print_help(): |
no test coverage detected