From 2e6ee5716210488eb20f7c9d8387ab2180e07cb6 Mon Sep 17 00:00:00 2001 From: Florian Heilmann Date: Wed, 25 Sep 2019 22:09:20 +0200 Subject: [PATCH] ActionPrompts: More flexibility for selection_command Allow users to control how and where the choice is inserted into the response by explicitly including "{choice}" in the selection_command --- src/octoprint/plugins/action_command_prompt/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/action_command_prompt/__init__.py b/src/octoprint/plugins/action_command_prompt/__init__.py index dc5f796e8..bfebac31e 100644 --- a/src/octoprint/plugins/action_command_prompt/__init__.py +++ b/src/octoprint/plugins/action_command_prompt/__init__.py @@ -207,7 +207,10 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin, return self._close_prompt() - self._printer.commands(["{command} S{choice}".format(command=self._command, + if "{choice}" in self._command: + self._printer.commands([self._command.format(choice=choice)]) + else: + self._printer.commands(["{command} S{choice}".format(command=self._command, choice=choice)])