-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Click is expanding globs in a string and I don't want it to. #2499
Comments
I believe that's working as intended because on Windows it's up to each program to expand globs, while on linux it's the shell taking care of it... Related discussion: #1096 |
The problem is that you were initially trying to make it so that Windows would behave in the same way as linux/osx. But in linux/osx, an option with wildcards that is passed in quotation marks is automatically passed as a string, while one passed without quotation marks is globbed first. The commands It seems to me that instead of having the programmer pass a windows_expand_args switch (which is not intuitive and will likely result in questions like mine above), it would be better to simply first check if the argument is surrounded by quotation marks, and if it is, simply pass it through as a string, and if it isn't, glob it as you currently do. That would give consistent behavior across operating systems, and result in less headaches for both the programmer and the people parsing these issues. |
Thanks, but I don't plan to change this. It is not possible to check for quotations, they are not in sys.argv. Disable it and do your own processing if needed. |
I have a program that I would like to pass a string containing a path with globbed filenames in it...
>> myprogram "myfile*.txt"
This behaves differently on windows vs linux/osx
I want the files*.txt portion to come in as a string, but it appears that on Windows machines it's getting unglobbed before I can get to it...
For example, if I have files myfile1.txt, myfile2.txt, myfile3.txt, myfile4.txt
when I run
>> myprogram "myfile*.txt"
I get the errorError: Got unexpected extra arguments (myfile2.txt myfile3.txt myfile4.txt)
it uses myfile1.txt as the argument, and the other 3 are considered extra
looking around I found this #1830 where you are expanding Windows globs before processing them so you can get the same expected behavior on Windows as on Linux/osx, That's great, but I specifically want to pass the string as is...
ie
myprogram "myfile*.txt"
versusmyprogram myfile*.txt
(no quotation marks)Is there a way to force click to read that in as a string and NOT glob it?
Environment:
Thanks
The text was updated successfully, but these errors were encountered: