Switch argument for command template

I've been trying to add both a kayword argument and a switch argument to my add-in script, but I must be doing something wrong. When I invoke my custom command without the switch argument, I can process the keyword argument just fine; when I add the switch, however, the keyword always comes up "undefined".

My command template looks like this:

cmd2.template = "ARTIST/K, REPLACE/S";

Here is the function code that processes the ARTIST argument:

var tag_to_add;
if (ScriptCommandData.func.args.got_arg.ARTIST) {
	var tag_to_add = d.func.args.ARTIST;
	DOpus.Output("Tag to add: " + tag_to_add);
}
else {
	DOpus.output("ERROR: no artist argument found");
	return;
}

When I call the function like this, it processes the argument correctly:

add_artist ARTIST=chet_baker

However, when I call the function like this:

add_artist ARTIST=chet_baker REPLACE

I get "ERROR: no artist argument found". I've tried different variations such as swapping the order of arguments, adding "/O" to the switch, removing the "=" -- nothing seems to work.

Can you post the whole script? It would be easier for me to try some things

Edit: Actually try removing the space in the argument template like this:
ARTIST/K,REPLACE/S

I've ran into that issue before. It also seems to fix it at least when I tested a slightly modified user command version of your code:

function OnClick(clickData)
{
	var tag_to_add;
	if (clickData.func.args.got_arg.ARTIST) {
		var tag_to_add = clickData.func.args.ARTIST;
		DOpus.Output("Tag to add: " + tag_to_add);
	}
	else {
		DOpus.output("ERROR: no artist argument found");
		return;
	}
}

@Leo If I'm correct that argument templates aren't supposed to have spaces in them, it might be worth adding a mention about that in the wiki

Wow, that was it. Never thought it might be a space issue.

Thanks!

Need to look in more detail but we might be able to make spaces in templates work or filter them out automatically. If not, we'll add a note to the docs.

That's done for 13.7.6 when it comes out.

Ah awesome