chore: clean up code

pull/760/head
Wen Junhua 2023-12-25 23:17:40 +09:00
parent eb527de54b
commit 3c81e00bed
1 changed files with 3 additions and 5 deletions

View File

@ -15,7 +15,7 @@ DEFAULT_BASE_URL = (
+ "%s.svg" + "%s.svg"
) )
DEFAULT_BASE_PATH = os.path.join(os.getcwd(), "..") DEFAULT_BASE_PATH = os.path.join(os.getcwd(), "..")
DEFAULT_ICON_PATH = os.path.join( DEFAULT_ICON_DIR_PATH = os.path.join(
DEFAULT_BASE_PATH, DEFAULT_BASE_PATH,
"assets", "assets",
"icons", "icons",
@ -99,7 +99,7 @@ def save_file(name: str, svg: str) -> None:
logging.debug(f"saving icon to {file_name}") logging.debug(f"saving icon to {file_name}")
with open( with open(
os.path.join( os.path.join(
DEFAULT_ICON_PATH, DEFAULT_ICON_DIR_PATH,
file_name, file_name,
), ),
"w", "w",
@ -141,8 +141,6 @@ def parse_args() -> Tuple[str, str, int]:
parse_res = parser.parse_args() parse_res = parser.parse_args()
url = DEFAULT_BASE_URL % parse_res.name url = DEFAULT_BASE_URL % parse_res.name
if parse_res.url is not None: if parse_res.url is not None:
if len(parse_res.url) != 1:
raise ValueError("Invalid URL arguments. Use -h for help.")
url = parse_res.url[0] url = parse_res.url[0]
log_level = logging.DEBUG if parse_res.verbose else logging.INFO log_level = logging.DEBUG if parse_res.verbose else logging.INFO
@ -175,7 +173,7 @@ if __name__ == "__main__":
logging.debug("saving icon to assets") logging.debug("saving icon to assets")
save_file(icon_name, final_svg) save_file(icon_name, final_svg)
# Write to docs (TODO) # Write to docs
logging.debug("updating") logging.debug("updating")
update_docs(icon_name) update_docs(icon_name)