瀏覽代碼

cli: unbreak `dulwich` script

The first value in `sys.argv` is the name of the script invoked,
with actual arguments following. Previously, any attempt to invoke the
script would yield e.g.:

  $ dulwich
  No such subcommand: /path/to/dulwich

This was presumably never noticed due to `python -m dulwich.cli`
explicitly passing in `sys.argv[1:]`.

See <https://docs.python.org/3/library/sys.html#sys.argv> for details.
Dan Villiom Podlaski Christiansen 3 年之前
父節點
當前提交
12b7b312ac
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      dulwich/cli.py

+ 2 - 2
dulwich/cli.py

@@ -731,7 +731,7 @@ commands = {
 
 def main(argv=None):
     if argv is None:
-        argv = sys.argv
+        argv = sys.argv[1:]
 
     if len(argv) < 1:
         print("Usage: dulwich <%s> [OPTIONS...]" % ("|".join(commands.keys())))
@@ -752,4 +752,4 @@ if __name__ == "__main__":
         signal.signal(signal.SIGQUIT, signal_quit)  # type: ignore
     signal.signal(signal.SIGINT, signal_int)
 
-    sys.exit(main(sys.argv[1:]))
+    sys.exit(main())