Skip to content

Commit

Permalink
feat: fill long_name with description if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
iranzo committed Nov 18, 2022
1 parent 2d77856 commit c34ece4
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions risuclient/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,26 +1306,37 @@ def generic_get_metadata(plugin, comment="#"):
].strip()
path = path.replace("${RISU_ROOT}", "")

description = regexpfile(
filename=plugin["plugin"], regexp=r"\A%s description:" % comment
)[14 + offset :].strip()
long_name = regexpfile(
filename=plugin["plugin"], regexp=r"\A%s long_name:" % comment
)[12 + offset :].strip()
bugzilla = regexpfile(
filename=plugin["plugin"], regexp=r"\A%s bugzilla:" % comment
)[11 + offset :].strip()

priority = int(
regexpfile(filename=plugin["plugin"], regexp=r"\A%s priority:" % comment)[
11 + offset :
].strip()
or 0
)

kb = regexpfile(filename=plugin["plugin"], regexp=r"\A%s kb:" % comment)[
5 + offset :
].strip()

if long_name == "":
long_name = description

metadata = {
"description": regexpfile(
filename=plugin["plugin"], regexp=r"\A%s description:" % comment
)[14 + offset :].strip(),
"long_name": regexpfile(
filename=plugin["plugin"], regexp=r"\A%s long_name:" % comment
)[12 + offset :].strip(),
"bugzilla": regexpfile(
filename=plugin["plugin"], regexp=r"\A%s bugzilla:" % comment
)[11 + offset :].strip(),
"priority": int(
regexpfile(filename=plugin["plugin"], regexp=r"\A%s priority:" % comment)[
11 + offset :
].strip()
or 0
),
"description": description,
"long_name": long_name,
"bugzilla": bugzilla,
"priority": priority,
"path": path,
"kb": regexpfile(filename=plugin["plugin"], regexp=r"\A%s kb:" % comment)[
5 + offset :
].strip(),
"kb": kb,
}
return metadata

Expand Down

0 comments on commit c34ece4

Please sign in to comment.