···67676868Another issue.
6969```
7070+7171+### One-shot mode
7272+7373+You can also create a single issue directly from the command line with `issurge new`.
7474+7575+If you end the line with `:`, issurge will prompt you for more lines.
7676+7777+```sh-session
7878+$ issurge new ~tag1 a tag right there @me :
7979+Please enter a description for the issue (submit 2 empty lines to finish):
8080+> Basically allow users to enter an issue fragment directly on the command line with a subcommand, and if it expects a description, prompt for it
8181+>
8282+>
8383+Submitting add an interactive "one-shot" (...) ~enhancement @me [...]
8484+Running gh issue new -t "add an interactive \"one-shot\" mode" -b "Basically allow users to enter an issue fragment directly on the command line with a subcommand, and if it expects a description, prompt for it" -a @me -l enhancement
8585+```
+25
issurge/interactive.py
···11+from .parser import Issue, parse
22+33+44+def create_issue(words: str) -> Issue:
55+ issue, expects_description = Issue.parse(words)
66+ if expects_description:
77+ print(
88+ "Please enter a description for the issue (submit 2 empty lines to finish):"
99+ )
1010+ description = ""
1111+ next_empty_is_finish = False
1212+ while True:
1313+ line = input("> ")
1414+ if line == "":
1515+ if next_empty_is_finish:
1616+ break
1717+ next_empty_is_finish = True
1818+ else:
1919+ next_empty_is_finish = False
2020+2121+ description += line + "\n"
2222+2323+ issue = Issue(**(issue._asdict() | {"description": description.strip()}))
2424+2525+ return issue
+12-3
issurge/main.py
···11#!/usr/bin/env python
22"""
33Usage:
44- issurge [options] <file> [--] [<submitter-args>...]
44+ issurge [options] new <words>...
55+ issurge [options] <file> [--] [<submitter-args>...]
56 issurge --help
6788+issurge new <words>... acts like echo <words>... | issurge /dev/stdin, but also asks for a description if the issue ends with `:'.
99+710<submitter-args> contains arguments that will be passed as-is to the end of all `glab' commands
811912Options:
···18211922from issurge.parser import parse
2023from issurge.utils import debug
2424+from issurge import interactive
212522262327def run(opts=None):
···2630 os.environ["ISSURGE_DRY_RUN"] = "1" if opts["--dry-run"] else ""
27312832 debug(f"Running with options: {opts}")
2929- print("Submitting issues...")
3030- for issue in parse(Path(opts["<file>"]).read_text()):
3333+ if opts["new"]:
3434+ issue = interactive.create_issue(" ".join(opts["<words>"]))
3535+ debug(f"Submitting {issue.display()}")
3136 issue.submit(opts["<submitter-args>"])
3737+ else:
3838+ print("Submitting issues...")
3939+ for issue in parse(Path(opts["<file>"]).read_text()):
4040+ issue.submit(opts["<submitter-args>"])