editconf.py: better error message if command line arguments are not valid

This commit is contained in:
Joshua Tauberer 2015-04-11 15:25:11 -04:00
parent c38bdbb0c5
commit 2cab9d5514
1 changed files with 8 additions and 0 deletions

View File

@ -54,6 +54,14 @@ while settings[0][0] == "-" and settings[0] != "--":
print("Invalid option.") print("Invalid option.")
sys.exit(1) sys.exit(1)
# sanity check command line
for setting in settings:
try:
name, value = setting.split("=", 1)
except:
import subprocess
print("Invalid command line: ", subprocess.list2cmdline(sys.argv))
# create the new config file in memory # create the new config file in memory
found = set() found = set()