Expand globs in arguments on Windows? #1096
I'm using a variadic
"paths", nargs=-1, type=click.Path(exists=True, dir_okay=False)
When I run
The text was updated successfully, but these errors were encountered:
My first reaction is that this shouldn't be done by Click, although it should be possible to subclass
IMHO such behavior would have to be completely disabled on non-Windows systems.
Maybe the least strange/error-prone solution would be to have a
The Windows convention that it is every program's job to make up for cmd not having globs, yes. "Annoying thing that every cli app has to do" seems like it falls within click's scope.
I believe in traditional Windows globbing the metacharacters are
As @ThiefMaster notes, you'd only enable enable this on Windows. But what if someone is using mingw bash on Windows? Well, then you might double-expand, just like every other traditional Windows cli program would in the same situation.
That would be an interesting option for
I'm not really familiar with how click uses envvars. As a Unix user I would expect
It would be less efficient, but the easiest way would be to always pass values through expanduser and glob first.
Is there a way to signal that something glob-like isn't a glob, like single quotes on Unix?
One last thing I thought of. What happens when using
I'm not sure. In Windows, quote handling is also done in process (basically you just get a raw command line string and are free to do whatever with it), so in principle you could use quotes to disable globbing for specific arguments. But in Python, the quote handling happens early in interpreter startup, so you can't see them in
Python's glob module lets you use
I don't know enough about click and
Hello, I came here from the Black project, because running
I think leaning on Python's
To reiterate njsmith, this would have to be a Windows-only feature. The * and ? characters are illegal to have in files on Windows anyway (I assume this is an NTFS thing.)
Nah. This isn't a Windows command line idiom. It'd be easier to leave it unimplemented, given that
Anyway, my comments mostly reiterate what njsmith said. I'd just like to shed more light on this issue because "wildcards don't work on Windows" seems like a pretty big deal for every program that uses Click.
Thinking about this again, processing should only happen in
So the solution for this is to add a call to
I think we should also call