<p>I am actually working on issue/feature request <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="312718056" data-permission-text="Issue title is private" data-url="https://github.com/geany/geany-plugins/issues/733" href="https://github.com/geany/geany-plugins/issues/733">geany/geany-plugins#733</a>.</p>
<p>I extended the workbench plugin and now it allows to create global and projects commands, to store the values in the projects and workbench file and to inherit global workbench commands to the projects. This are all workbench internal functions.</p>
<p>When it comes to actually execute a command I planned to use <code>build_set_menu_item()</code>, <code>build_activate_menu_item()</code> and to introduce a new build source called <code>GEANY_BCS_PLUGIN</code>. But just adding a new build source is not doing the job. I guess <code>build_activate_menu_item()</code> is simply ignoring a new value.</p>
<p>Also, the workbench plugin maintains several projects and that would mean to re-write the commands each time by calling <code>build_activate_menu_item()</code>. And the functions doesn't seem to free old values by itself.</p>
<p>I came to the conclusion that for my approach (and maybe for other plugins) it might be more suitable to have a direct plugin call like</p>
<pre><code>build_execute_command(BUILD_TARGET_COMPILER, command, workingdir);
</code></pre>
<p>The first parameter given should tell if the command output goes to the "Compiler" message window. An alternative value would be BUILD_TARGET_NEW_TERMINAL which means start a terminal and run the command in it. This seems to be what the groups <code>GEANY_GBG_FT</code>  /<code>GEANY_GBG_NON_FT</code> and <code>GEANY_GBG_EXEC</code> do today.</p>
<p>The API call should work in a Fire&Forget manner: parameters <code>command</code> and <code>workingdir</code> should be copied (if necessary). Then run the command as described above and once finished simply forget about <code>command</code> and <code>workingdir</code>.</p>
<p>What do you think?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/1897">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ7mICGD-tVOX9HFr1-vvUcpMp4RKks5uG0NvgaJpZM4VQPyq">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJ0EoNOdpUggXkFpmkU6oG_pwnuBoks5uG0NvgaJpZM4VQPyq.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Plugin API extension request: execute build command directly (#1897)"}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1897"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/1897",
"url": "https://github.com/geany/geany/issues/1897",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Plugin API extension request: execute build command directly (#1897)",
"sections": [
{
"text": "",
"activityTitle": "**LarsGit223**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@LarsGit223",
"facts": [
{
"name": "Repository: ",
"value": "geany/geany"
},
{
"name": "Issue #: ",
"value": 1897
}
]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"geany/geany\",\n\"issueId\": 1897,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"geany/geany\",\n\"issueId\": 1897\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/geany/geany/issues/1897"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 356580522\n}"
}
],
"themeColor": "26292E"
}
]</script>