File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,21 @@ def generate_inputrc(fd=sys.stdout, use_unicode=True) -> None:
3131 for alias in aliased_characters :
3232 fd .write (_format (alias , use_unicode ))
3333
34+ def usage ():
35+ sys .stderr .write ("usage: %s {inputrc-unicode | inputrc-no-unicode}\n " % sys .argv [0 ])
36+ sys .exit (1 )
37+
3438if __name__ == "__main__" :
39+ if len (sys .argv ) < 2 :
40+ usage ()
41+
3542 if sys .argv [1 ] == "inputrc-unicode" :
43+ default_encoding = sys .getdefaultencoding ()
44+ if default_encoding != "utf-8" :
45+ sys .stderr .write ("sys.defaultencoding() is %s so we can't generate unicode output\n " % (default_encoding ))
46+ sys .exit (2 )
3647 generate_inputrc (use_unicode = True )
3748 elif sys .argv [1 ] == "inputrc-no-unicode" :
3849 generate_inputrc (use_unicode = False )
39-
50+ else :
51+ usage ()
You can’t perform that action at this time.
0 commit comments