checkmate5 4.1.0.dev42__py3-none-any.whl → 4.1.0.dev43__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,6 +46,7 @@ root.addHandler(ch)
46
46
 
47
47
 
48
48
  def load_command_class(settings):
49
+ """Parses sys.argv to find and load the appropriate command class."""
49
50
  i = 1
50
51
  command_chain = []
51
52
  current_commands = settings.commands
@@ -57,7 +58,7 @@ def load_command_class(settings):
57
58
  cmd = sys.argv[i]
58
59
  command_chain.append(cmd)
59
60
  i += 1
60
- if not cmd in current_commands:
61
+ if cmd not in current_commands:
61
62
  sys.stderr.write("Unknown command: %s\n" % " ".join(command_chain))
62
63
  exit(-1)
63
64
  if not isinstance(current_commands[cmd], dict):
@@ -65,19 +66,19 @@ def load_command_class(settings):
65
66
  command_module_name, command_class_name = current_commands[cmd].rsplit(".", 1)
66
67
  command_module = importlib.import_module(command_module_name)
67
68
  return getattr(command_module, command_class_name), command_chain
68
- else: # it is a class
69
- return current_commands[cmd], command_chain
70
- current_commands = current_commands[cmd]
69
+ else: # it is a class
70
+ return current_commands[cmd], command_chain
71
+ current_commands = current_commands[cmd]
71
72
 
72
73
 
73
74
  def main():
74
75
 
75
76
  if not os.path.isdir('.git'):
76
- sys.stderr.write("Not a git repository.\nTry running: \"git init && git add . && git commit -m \"init\" \" in the folder\n")
77
- exit(-1)
78
- if not "CODE_DIR" in os.environ:
79
- sys.stderr.write("CODE_DIR env not set. Please set it to directory of your code.\nTry running: \"export CODE_DIR=/path/to/code\" before\n")
80
- exit(-1)
77
+ sys.stderr.write("Not a git repository.\nTry running: \"git init && git add . && git commit -m \"init\" \" in the folder\n")
78
+ exit(-1)
79
+ if "CODE_DIR" not in os.environ:
80
+ sys.stderr.write("CODE_DIR env not set. Please set it to directory of your code.\nTry running: \"export CODE_DIR=/path/to/code\" before\n")
81
+ exit(-1)
81
82
 
82
83
  project_path = get_project_path()
83
84
 
@@ -105,13 +106,19 @@ def main():
105
106
  prog=sys.argv[0]+" "+" ".join(command_chain),
106
107
  args=sys.argv[1+len(command_chain):])
107
108
  try:
109
+ # Check for the 'help' command first
108
110
  if 'help' in command.opts and command.opts['help']:
109
111
  print((command.help_message()))
110
112
  exit(0)
113
+
114
+ # Execute the command's main logic
111
115
  result = command.run()
116
+
117
+ # Serialize and print the result if the command supports it
112
118
  if hasattr(command, 'serialize'):
113
119
  result_str = command.serialize(result, 'text')
114
120
  print(result_str)
121
+
115
122
  except KeyboardInterrupt:
116
123
  print("[CTRL-C pressed, aborting]")
117
124
  exit(-1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: checkmate5
3
- Version: 4.1.0.dev42
3
+ Version: 4.1.0.dev43
4
4
  Summary: A meta-code checker written in Python.
5
5
  Author: Andreas Dewes
6
6
  License: AGPL-3.0
@@ -107,13 +107,13 @@ checkmate/management/commands/props/delete.py,sha256=skrsBtAz-w_4_ZpX88AADWBGcmg
107
107
  checkmate/management/commands/props/get.py,sha256=YsvE_sr8ViIvpjLJ7sPMp6UoujKGWMrcaZMnAVfQnNs,763
108
108
  checkmate/management/commands/props/set.py,sha256=VEoFbHletPqZXeHdiqXOGbgLArf4FHBZNupNH4DaRIo,728
109
109
  checkmate/scripts/__init__.py,sha256=XAi0y8z1NviyGvLB68Oxnzr6Nw5AP8xgbcSSnc1Zcvw,766
110
- checkmate/scripts/manage.py,sha256=Ci0HBkvB_KzGIQTAr1UnwEXWuqDq7MP2e7Y_7p2CC94,4213
110
+ checkmate/scripts/manage.py,sha256=vb4L171yfctLbZpQxn_kZ1hQLtCDqdQQGiq7BJlnQ2A,4494
111
111
  checkmate/settings/__init__.py,sha256=z32hPz-kGS-tTGa6dWCFjrrrbS_eagLd-YrqBP3gjWI,33
112
112
  checkmate/settings/base.py,sha256=3WBXZITqoWepIja96bo5JTi-TDpQALPTCugL0E8z-yE,4551
113
113
  checkmate/settings/defaults.py,sha256=JaR9H5fciWy4PMX3oqIeaui7HDzjWSIhsXZD3tj4mSc,2736
114
- checkmate5-4.1.0.dev42.dist-info/licenses/LICENSE.txt,sha256=SGQTFjJQjkYGoK1PCFfMKpfgRLm3yL0h9Mq2o26sm2E,151451
115
- checkmate5-4.1.0.dev42.dist-info/METADATA,sha256=znr31OI8-Tw2pKYmCG6VkEXCP6mazp7AuCPwQ3fOIh4,1286
116
- checkmate5-4.1.0.dev42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
117
- checkmate5-4.1.0.dev42.dist-info/entry_points.txt,sha256=FbGnau5C4z98WmBYpMJqUzobQEr1AIi9aZApSavNojQ,60
118
- checkmate5-4.1.0.dev42.dist-info/top_level.txt,sha256=tl6eIJXedpLZbcbmYEwlhEzuTaSt0TvIRUesOb8gtng,10
119
- checkmate5-4.1.0.dev42.dist-info/RECORD,,
114
+ checkmate5-4.1.0.dev43.dist-info/licenses/LICENSE.txt,sha256=SGQTFjJQjkYGoK1PCFfMKpfgRLm3yL0h9Mq2o26sm2E,151451
115
+ checkmate5-4.1.0.dev43.dist-info/METADATA,sha256=10L_s4YCJSToO_TZu5NtzluPV9Lnooz2xoKPuwIYc3k,1286
116
+ checkmate5-4.1.0.dev43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
117
+ checkmate5-4.1.0.dev43.dist-info/entry_points.txt,sha256=FbGnau5C4z98WmBYpMJqUzobQEr1AIi9aZApSavNojQ,60
118
+ checkmate5-4.1.0.dev43.dist-info/top_level.txt,sha256=tl6eIJXedpLZbcbmYEwlhEzuTaSt0TvIRUesOb8gtng,10
119
+ checkmate5-4.1.0.dev43.dist-info/RECORD,,