vapoursynth-preview icon indicating copy to clipboard operation
vapoursynth-preview copied to clipboard

command line option -a doesn't match vspipe's behavior

Open AkarinVS opened this issue 3 years ago • 3 comments

The current behavior of -a (passing command line to the script via sys.argv is incompatible with that of vspipe, which makes portable scripts impossible.

Another drawback is that sometimes you will have to double escape the arguments (i.e. when passing a value including a \). I think vspipe's -a is much nicer, and we don't need to bother with using shlex.split to reparse the command line.

I have a rough patch ready, but, before sending it in, I'd like to gather some opinions on this issue as it's an incompatible change.

AkarinVS avatar Mar 22 '21 14:03 AkarinVS

What is available now is a feature contributed by @wallace11, who considered vspipe's approach syntactically ugly. As for me, I don't have strong preference for any of them, and I don't see why VSP can't provide both. One more point I'd like to make is that vspipe-style arguments should use a key different to -a to prevent confusion of VSP users who have been using it.

Endilll avatar Mar 22 '21 15:03 Endilll

Well, if I want to provide multiple complicated filenames to a script from the command line, then it's easier with vspipe's -a than vsp's -a.

vspipe's solution might be ugly, but it's more usable for this case: Shells generally provide nice filename completion features for -a fn1=/path/to/file1, but you can't use the file completion feature at all once you start a quote with a filenames in the front. If we want to keep the current feature, at least we should make it repeatable so that each -a provides a new argument to the script and not reparse the string vis shlex.split. compare: run.py input.vpy -a "fileame1 filename2" # won't be able to auto-complete filename2 run.py input.vpy -a "filename1" -a "filename2"

(Perhaps people don't see this issue because most just read sources from the current directory, so oftentimes the filename is very simple, like 00002.m2ts as most source filters insist on creating the index file in the same directory. But I have modified my source filters to not clobber the source directory at all, so I tend to use very long and complicated filenames for the source files in their original places. The current -a design makes it especially hard for me to specify the names via auto-completion.)

If we just introduce another flag modeled after vspipe's -a, do you have suggestions for the single character name and long names?

Thanks.

AkarinVS avatar Mar 23 '21 14:03 AkarinVS

-g and --global-vars, maybe? Enabling autocompletion support for your use-case is sure a strong point.

Endilll avatar Mar 23 '21 14:03 Endilll