How to omit the default argument name when a custom command has only one argument?

https://resource.dopus.com/t/everythingopus-a-better-dialog-to-integrate-everything-with-directory-opus/56212
For example, in this script above, the command "ed" has only one argument:

	var searchCmd = initData.AddCommand();
	searchCmd.name     = "ed";
	searchCmd.method   = "OnEverythingOpusSearch";
	searchCmd.desc     = DOpus.strings.Get("cmdDesc_ed");
	searchCmd.label    = "Everything DOpus Search";
	searchCmd.template = "S/R"; //the only one parameter,type:Raw

When I use the command,if the search string contains spaces, the 's' argument name cannot be omitted

ed s wall paper *.png

I hope to execute the command like this:

ed wall paper *.png

Is it possbile?

Use quotes or extract the argument from scriptCmdData.cmdline.

1 Like

You can also make the argument type “raw” (/R) and it will consume the rest of the command line without needing quotes.

(Unless that stops it being the default argument and forces you to state the argument name at the start if the command line. Not sure about that actually, and not at my PC to test what happens.)

1 Like

I have set the argument type to raw, but the string must be enclosed in double quotation marks when it contains spaces.

It seems that scriptCMDData.cmdline is the only solution.

Raw args shouldn’t need quotes. That’s the whole reason for them.

1 Like

If run the command without specifying argument name, the string containing spaces must be enclosed in double quotation. OR, each space separated string will be treated as an argument .

If run the command with specifying argument name(type RAW), args do not need quotes.

This is my test result... :grinning_face_with_smiling_eyes:

You're right.

We'll make it possible to have a default raw argument in the next beta.

1 Like