Skip to content

Add the option to remove unparsable fonts#11

Merged
whtsky merged 9 commits intowhtsky:masterfrom
Zopolis4:master
May 12, 2021
Merged

Add the option to remove unparsable fonts#11
whtsky merged 9 commits intowhtsky:masterfrom
Zopolis4:master

Conversation

@Zopolis4
Copy link
Copy Markdown
Contributor

This commit adds the option to remove unparsable fonts as opposed to printing an error message (not collections, due to the way the script handles them. working on that). It also adds support for creating further argparse arguments while keeping the sys.argv path variable intact.

This commit adds the option to remove unparsable fonts (not collections)
Removes the (currently) unused atexit module, which was a remnant from my attempts to support removing unparseable .otc/.ttc files
Comment thread font_rename.py Outdated
Comment thread font_rename.py Outdated
Comment thread font_rename.py Outdated

parser.add_argument("-ru", "--remove-unparsable", dest="ru", action="store_true", help="When this option is enabled, unparsable fonts are removed instead of ignored")

args, unknown = parser.parse_known_args()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put argparse related code into the main function?

putting it on top-level means importing font_rename will execute these code too -- might cause some unexpected error

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I tried that, it broke the script

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it broke the script

Can you provide more info?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rename_font should accept a new argument remove_unparsable instead of referring to global variable args

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how to do that

Comment thread font_rename.py Outdated
Comment thread font_rename.py Outdated
@Zopolis4 Zopolis4 requested a review from whtsky May 11, 2021 22:04
Copy link
Copy Markdown
Owner

@whtsky whtsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall

@whtsky whtsky merged commit 6eb9f30 into whtsky:master May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants