···37373838Indentation is done with tab characters only.
39394040-- **Title:** The title is made up of any word in the line that does not start with `~`, `@` or `%`. Words that start with any of these symbols will not be added to the title, except if they are in the middle (in that case, they both get added as tags/assignees/milestones and as a word in the title, without the prefix symbol)
4040+- **Title:** The title is made up of any word in the line that does not start with `~`, `@`, `%` or `#.`. Words that start with any of these symbols will not be added to the title, except if they are in the middle (in that case, they both get added as tags/assignees/milestones and as a word in the title, without the prefix symbol)
4141- **Tags:** Prefix a word with `~` to add a label to the issue
4242- **Assignees:** Prefix with `@` to add an assignee. The special assignee `@me` is supported.
4343- **Milestone:** Prefix with `%` to set the milestone
4444+- **References:** Prefix with `#.NUMBER` to define a reference for this issue. See [Cross-reference other issues](#cross-reference-other-issues) for more information.
4445- **Comments:** You can add comments by prefixing a line with `//`
4546- **Description:** To add a description, finish the line with `:`, and put the description on another line (or multiple), just below, indented once more than the issue's line. Exemple:
4647···69707071Another issue.
7172```
7373+7474+#### Cross-reference other issues
7575+7676+As you might know, you can link an issue to another by using `#NUMBER`, with `NUMBER` the number of the issue you want to reference. You could want to write that, to reference `First issue` in `Second issue`:
7777+7878+```
7979+First issue
8080+8181+Second issue:
8282+ Needs #11
8383+```
8484+8585+However, this assumes that the current latest issue, before running issurge on this file, is `#9`. It also assumes that issues get created in order (which is the case for now), and that no other issue will get created while running issurge.
8686+8787+As managing all of this by hand can be annoying, you can create references in the issurge file:
8888+8989+```
9090+#.1 First issue
9191+9292+Second issue:
9393+ Needs #.1
9494+```
9595+9696+And that `#.1` in `Needs #.1` will be replaced by the actual issue number of `First issue` when the issue gets created.
9797+9898+> [!WARNING]
9999+> For now, issues are created in order, so you need to define a reference _before_ you can use it.
7210073101### One-shot mode
74102
+10-3
issurge/main.py
···11#!/usr/bin/env python
22"""
33Usage:
44- issurge [options] new <words>...
44+ issurge [options] new <words>...
55 issurge [options] <file> [--] [<submitter-args>...]
66 issurge --help
77···1313 --dry-run Don't actually post the issues
1414 --debug Print debug information
1515"""
1616+1617import os
1718from pathlib import Path
1819···3334 if opts["new"]:
3435 issue = interactive.create_issue(" ".join(opts["<words>"]))
3536 debug(f"Submitting {issue.display()}")
3636- issue.submit(opts["<submitter-args>"])
3737+ number = issue.submit(opts["<submitter-args>"])
3838+ print(f"Created issue #{number}")
3739 else:
3840 print("Submitting issues...")
4141+ references_resolutions: dict[int, int] = {}
3942 for issue in parse(Path(opts["<file>"]).read_text()):
4040- issue.submit(opts["<submitter-args>"])
4343+ issue = issue.resolve_references(references_resolutions, strict=True)
4444+ number = issue.submit(opts["<submitter-args>"])
4545+ print(f"Created issue #{number}")
4646+ if issue.reference and number:
4747+ references_resolutions[issue.reference] = number