Opens an editor with some text in it.
()
| 116 | |
| 117 | @cli.command() |
| 118 | def edit(): |
| 119 | """Opens an editor with some text in it.""" |
| 120 | MARKER = "# Everything below is ignored\n" |
| 121 | message = click.edit(f"\n\n{MARKER}") |
| 122 | if message is not None: |
| 123 | msg = message.split(MARKER, 1)[0].rstrip("\n") |
| 124 | if not msg: |
| 125 | click.echo("Empty message!") |
| 126 | else: |
| 127 | click.echo(f"Message:\n{msg}") |
| 128 | else: |
| 129 | click.echo("You did not enter anything!") |
| 130 | |
| 131 | |
| 132 | @cli.command() |