Discussion:
[Geany-Users] ? Capturing context_action's output
e***@prolan-power.hu
2018-09-12 15:42:13 UTC
Permalink
Hi,

Is there any way to capture the "context action"'s output?
(And show it in the Messages tab, as for "Find in files".)

Is
context_action_cmd=grep "%s" /some/dir
(or similar, i.e. console commands) valid at all?
(Currently does not seem to work.. Nothing happens..)

--
Lex Trotman
2018-09-12 22:48:00 UTC
Permalink
Post by e***@prolan-power.hu
Hi,
Is there any way to capture the "context action"'s output?
(And show it in the Messages tab, as for "Find in files".)
Is
context_action_cmd=grep "%s" /some/dir
(or similar, i.e. console commands) valid at all?
(Currently does not seem to work.. Nothing happens..)
Context actions do not collect the results of the subprocess nor
monitor its completion, they are intended for external actions, the
example given in the manual is opening a browser page for the selected
item.

Custom commands substitute their output in the text, build commands
show their output in the compiler window, but currently there is no
user controllable command that shows its results in the message
window.

Cheers
Lex
Post by e***@prolan-power.hu
--
_______________________________________________
Users mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/users
e***@prolan-power.hu
2018-09-13 23:47:40 UTC
Permalink
This post might be inappropriate. Click to display it.
Lex Trotman
2018-09-14 00:42:39 UTC
Permalink
Post by e***@prolan-power.hu
Hi,
Post by Lex Trotman
Context actions do not collect the results of the subprocess
But if I have an xterm-like program (xfce4-terminal, under Xubuntu) then it can launch bash, bash can run the
context action, and leave the window open, and show me the result.
I found that if I set the context action to
xfce4-terminal --tab --working-directory=/home/xxx/yyy/zzz -x bash -vc 'echo "%p" && grep -PIr "^using +%s +=";
echo "--$?--" && read -sN1'
then the context action works and -- in my xfce4-terminal, in the last (new) tab -- I can inspect the results.
(The action is, given a word zzz, to grep for "using zzz ="-like texts in directory (and below) /home/xxx/yyy/zzz.)
Yes, the command can do anything.
Post by e***@prolan-power.hu
- The context action does not know about "%p". I wish it would. Currently the action works only for this project
(project's base dir is hardcoded).
Its possible, pull requests are welcome.
Post by e***@prolan-power.hu
- I have to leave Geany and switch to the xfce4-terminal window. (It does not even brings to front currently.)
No integration. (In the Messages pane I could click on a line and Geany would open the file and seek to the line
and highlight the word..)
Post by Lex Trotman
build commands show their output in the compiler window
- [The build commands] do not know about (recenty, and if I am correct) the %s wildcard. (Perhaps with a minimal
effort, it could recognize it.)
Selection is not really relevant to the main use-case of build
commands, nonetheless a pull request may be accepted.

To reiterate my response above:

- context actions are intended to run commands that are not monitored by Geany

- build commands are intended to run commands that are monitored and
parsed for compile errors and shown in the compile tab or to execute
the built program and show its output in the built-in terminal or a
separate terminal.

- custom commands are intended to be fed the selection via stdin and
the output monitored and used to replace the selection

Your use-case is a command that is run and its output monitored and
shown in the messages window, which is none of the above.

So as I said Geany does not currently support it. You could create an
enhancement request, but I think it already exists.

Cheers
Lex
Post by e***@prolan-power.hu
--
_______________________________________________
Users mailing list
https://lists.geany.org/cgi-bin/mailman/listinfo/users
Loading...