···2233Deal with your client's feedback efficiently by creating a bunch of issues in bulk from a text file.
4455-Only supports gitlab for now.
55+## Supported platforms
6677-Requires `glab`.
77+- Gitlab (including custom instances): requires [`glab`](https://gitlab.com/gitlab-org/cli#installation) to be installed
88+- Github: requires [`gh`](https://github.com/cli/cli#installation) to be installed
89910## Installation
1011···14151516## Usage
16171818+The command needs to be run inside of the git repository (this is used to detect if the repository uses github or gitlab)
1919+1720```
1821issurge [options] <file> [--] [<glab-args>...]
1922issurge --help
2023```
21242222-- **<glab-args>** contains arguments that will be passed as-is to every `glab` command.
2525+- **<glab-args>** contains arguments that will be passed as-is to every `glab` command.
23262427### Options
2528···3437- **Tags:** Prefix a word with `~` to add a label to the issue
3538- **Assignees:** Prefix with `@` to add an assignee. The special assignee `@me` is supported.
3639- **Milestone:** Prefix with `%` to set the milestone
3737-- **Comments:** You can add comments by prefixing a line with `//`
4040+- **Comments:** You can add comments by prefixing a line with `//`
3841- **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:
3939- ```
4040- My superb issue ~some-tag:
4141- Here is a description
42424343- I can skip lines
4444- Another issue
4545- ```
4343+ ```
4444+ My superb issue ~some-tag:
4545+ Here is a description
4646+4747+ I can skip lines
4848+ Another issue
4949+ ```
46504747- Note that you cannot have indented lines inside of the description (they will be ignored).
5151+ Note that you cannot have indented lines inside of the description (they will be ignored).
48524953#### Add some properties to multiple issues
50545155You can apply something (a tag, a milestone, an assignee) to multiple issues by indenting them below:
52565357```
5454-One issue
5858+One issue
55595660~common-tag
5761 ~tag1 This issue will have tags:
···61656266Another issue.
6367```
6464-6565-
+28
issurge/parser.py
···7474 return result
75757676 def submit(self):
7777+ remote_url = urlparse(
7878+ subprocess.run(["git", "remote", "get-url", "origin"]).stdout.decode()
7979+ )
8080+ if remote_url.hostname == "github.com":
8181+ self._github_submit()
8282+ else:
8383+ self._gitlab_submit()
8484+8585+ def _gitlab_submit(self):
7786 command = ["glab", "issue", "new"]
8787+ if self.title:
8888+ command += ["-t", self.title]
8989+ command += ["-d", self.description or ""]
9090+ for a in self.assignees:
9191+ command += ["-a", a if a != "me" else "@me"]
9292+ for l in self.labels:
9393+ command += ["-l", l]
9494+ if self.milestone:
9595+ command += ["-m", self.milestone]
9696+ command.extend(self._cli_options["<glab-args>"])
9797+ if self._cli_options["--dry-run"] or self._cli_options["--debug"]:
9898+ print(
9999+ f"{'Would run' if self._cli_options['--dry-run'] else 'Running'} [white bold]{subprocess.list2cmdline(command)}[/]"
100100+ )
101101+ if not self._cli_options["--dry-run"]:
102102+ subprocess.run(command)
103103+104104+ def _github_submit(self):
105105+ command = ["gh", "issue", "new"]
78106 if self.title:
79107 command += ["-t", self.title]
80108 command += ["-d", self.description or ""]