Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gitlab
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maubot
gitlab
Commits
58bdca13
Commit
58bdca13
authored
3 years ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
Fix using default repo in commands
parent
305fd2b0
No related branches found
No related tags found
No related merge requests found
Pipeline
#4797
passed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gitlab_matrix/commands/issue.py
+1
-1
1 addition, 1 deletion
gitlab_matrix/commands/issue.py
gitlab_matrix/util/arguments.py
+7
-5
7 additions, 5 deletions
gitlab_matrix/util/arguments.py
with
8 additions
and
6 deletions
gitlab_matrix/commands/issue.py
+
1
−
1
View file @
58bdca13
...
...
@@ -59,7 +59,7 @@ class CommandIssue(Command):
await
evt
.
reply
(
f
"
Commented on issue #
{
issue
.
iid
}
:
{
issue
.
title
}
"
)
@issue.subcommand
(
"
comments
"
,
aliases
=
(
"
read-comments
"
,),
help
=
"
Write a
comment on an issue.
"
)
help
=
"
Read
comment
s
on an issue.
"
)
@OptUrlAliasArgument
(
"
login
"
,
"
server URL or alias
"
,
arg_num
=
2
)
@OptRepoArgument
(
"
repo
"
,
"
repository
"
)
@command.argument
(
"
id
"
,
"
issue ID
"
,
parser
=
sigil_int
)
...
...
This diff is collapsed.
Click to expand it.
gitlab_matrix/util/arguments.py
+
7
−
5
View file @
58bdca13
...
...
@@ -43,16 +43,18 @@ class OptUrlAliasArgument(Argument):
class
OptRepoArgument
(
Argument
):
def
__init__
(
self
,
name
:
str
,
label
:
str
=
None
,
required
:
bool
=
False
)
->
None
:
super
().
__init__
(
name
,
label
=
label
,
required
=
required
)
super
().
__init__
(
name
,
label
=
label
,
required
=
required
,
pass_raw
=
True
)
def
match
(
self
,
val
:
str
,
evt
:
MessageEvent
,
instance
:
'
Command
'
,
**
kwargs
)
->
Tuple
[
str
,
Any
]:
repo
=
re
.
split
(
r
"
\s
"
,
val
,
1
)[
0
]
repo
,
*
rest
=
re
.
split
(
r
"
\s+
"
,
val
,
1
)
rest
=
rest
[
0
]
if
len
(
rest
)
>
0
else
""
default_repo
=
instance
.
bot
.
db
.
get_default_repo
(
evt
.
room_id
)
if
not
default_repo
or
re
.
fullmatch
(
r
"
\w+/[\w/]+
"
,
repo
):
return
val
[
len
(
repo
):],
repo
return
val
,
default_repo
if
not
default_repo
or
re
.
fullmatch
(
r
"
\w+/[\w\-./]+
"
,
repo
):
return
rest
[
0
],
repo
# TODO use default_repo.server somehow after multi-server stuff is fixed
return
val
,
default_repo
.
repo
def
optional_int
(
val
:
str
)
->
Optional
[
int
]:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment