소스 검색

cli: look for pack-objects --stdout option in the right place

The --stdout option is parsed into opts, not args.

Before this fix, using --stdout resulted in a usage warning:
$ git rev-list main | dulwich pack-objects --stdout                                                                     
Usage: dulwich pack-objects basename
Stefan Sperling 2 년 전
부모
커밋
b722dde872
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      dulwich/cli.py

+ 2 - 2
dulwich/cli.py

@@ -525,12 +525,12 @@ class cmd_pack_objects(Command):
     def run(self, args):
         opts, args = getopt(args, "", ["stdout"])
         opts = dict(opts)
-        if len(args) < 1 and "--stdout" not in args:
+        if len(args) < 1 and "--stdout" not in opts.keys():
             print("Usage: dulwich pack-objects basename")
             sys.exit(1)
         object_ids = [line.strip() for line in sys.stdin.readlines()]
         basename = args[0]
-        if "--stdout" in opts:
+        if "--stdout" in opts.keys():
             packf = getattr(sys.stdout, "buffer", sys.stdout)
             idxf = None
             close = []