| Conditions | 3 |
| Total Lines | 14 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import logging |
||
| 44 | def get_text_from_stdin(): |
||
| 45 | _how_to_quit = "Ctrl+z and then Enter" if on_windows else "Ctrl+d" |
||
| 46 | print( |
||
| 47 | f"[Writing Entry; on a blank line, press {_how_to_quit} to finish writing]\n", |
||
| 48 | file=sys.stderr, |
||
| 49 | ) |
||
| 50 | try: |
||
| 51 | raw = sys.stdin.read() |
||
| 52 | except KeyboardInterrupt: |
||
| 53 | logging.error("Write mode: keyboard interrupt") |
||
| 54 | print("[Entry NOT saved to journal]", file=sys.stderr) |
||
| 55 | sys.exit(0) |
||
| 56 | |||
| 57 | return raw |
||
| 58 |