Skip to content

Commit affca37

Browse files
committed
feat: add GitLab work report generation command and documentation
1 parent a27bb51 commit affca37

File tree

6 files changed

+34
-1
lines changed

6 files changed

+34
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# /work_report
2+
3+
Generate user weekly report based on issue and commit information
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# /work_report
2+
3+
根据用户 issue 信息和 commit 信息生成用户周日报
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import sys
2+
3+
from lib.workflow.decorators import check_input
4+
5+
6+
@check_input("请输入报告类型,daily 或 weekly")
7+
def main(input):
8+
if input == "daily":
9+
print("daily report")
10+
elif input == "weekly":
11+
print("weekly report")
12+
else:
13+
print("invalid report type")
14+
15+
16+
if __name__ == "__main__":
17+
main(sys.argv[1])
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
description: Generate work report based on the user's issue and commit information
2+
input: required
3+
help:
4+
en: README.md
5+
zh: README.zh.md
6+
steps:
7+
- run: $devchat_python $command_path/command.py "$input"

community/gitlab/work_report/template.md

Whitespace-only changes.

lib/workflow/decorators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import os
44
import sys
5+
from typing import Callable, Optional
56

67
from lib.ide_service import IDEService
78

@@ -51,14 +52,16 @@ def wrapper(*args, **kwargs):
5152
return decorator
5253

5354

54-
def check_input(description: str):
55+
def check_input(description: str, callback: Optional[Callable] = None):
5556
def decorator(func):
5657
@functools.wraps(func)
5758
def wrapper(*args, **kwargs):
5859
arg = sys.argv[1]
5960
if len(arg) == 0:
6061
print(description, file=sys.stderr)
6162
sys.exit(1)
63+
if callback:
64+
return callback(arg)
6265
return func(arg, *args, **kwargs)
6366

6467
return wrapper

0 commit comments

Comments
 (0)