-
Notifications
You must be signed in to change notification settings - Fork 475
ttx option parse order #3507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
how does it fail? |
I just tried your first ttx command and it actually works for me, i'm on macos using bash |
oh it's the second command I'm getting Yeah, ideally both should work. Thanks for letting us know. |
This has been a limitation of ttx's command line parser for a long time. I agree that it is |
hm it seems that it's a limitation of Python's getopt implementation
https://docs.python.org/3/library/getopt.html#getopt.getopt Maybe switching to a different argument parser (e.g. argparse) would fix this, but we'd have to be careful to match the existing command line behavior |
i'm inclined to leave as is and document its behavior in the --help maybe. Unless someone is volunteering to port it over to argparse |
looks like there's a https://docs.python.org/3/library/getopt.html#getopt.gnu_getopt which uses
Maybe that works? I'll give it a try and report back |
diff --git a/Lib/fontTools/ttx.py b/Lib/fontTools/ttx.py
index e7a068748..0adda52d7 100644
--- a/Lib/fontTools/ttx.py
+++ b/Lib/fontTools/ttx.py
@@ -375,7 +375,7 @@ def guessFileType(fileName):
def parseOptions(args):
- rawOptions, files = getopt.getopt(
+ rawOptions, files = getopt.gnu_getopt(
args,
"ld:o:fvqht:x:sgim:z:baey:",
[ I can now do e.g. it seems to work! I wonder if this has other side effects though... |
this is the source for gnu_getopts: i think it's safe to enable, i'll make a PR |
Whoa, speedy! thanks |
For me, the following command fails (tried to write to DejaVuSerif.ttx):
While this one succeeds:
I would like them both to work.
The text was updated successfully, but these errors were encountered: