Hi Dmitry, I'm banging my head against this:
$ ./gnulib-tool.py --test dirent <works, creates a temporary directory> $ ./gnulib-tool.py --test --destdir=../testdir-dirent dirent usage: gnulib-tool.py --help ./gnulib-tool.py: error: unrecognized arguments: dirent The argument parsing conventions for POSIX/GNU programs distinguish * option with 0 or 1 arguments, * non-option arguments. In strict POSIX and in gnulib-tool, the non-option arguments come last, that is, the user is not allowed to write $ ./gnulib-tool.py dirent --test --destdir=../testdir-dirent or $ ./gnulib-tool.py --test dirent --destdir=../testdir-dirent I'm fine with argument reordering, that is, to *allow* different ways of specifying the arguments. But gnulib-tool.py is currently *forcing* a specific argument order which is 1. invalid for gnulib-tool 2. not according to strict POSIX. Namely, it *forces* the syntax $ ./gnulib-tool.py --test dirent --destdir=../testdir-dirent or $ ./gnulib-tool.py --destdir=../testdir-dirent --test dirent This "unrecognized arguments" error is explained in https://stackoverflow.com/questions/12818146/ So, I think the fix will be to 1) replace the line cmdargs = parser.parse_args() with cmdargs, nonoption_args = parser.parse_known_args() 2) Revisit all uses of nargs='+' and nargs='*'. Bruno