Skip to contentSkip to conversation

Document how to use pipes and redirection with 'bind'

PATCH RESEND In review Wolfram Sang 2 participants 3 messages May 2, 2020 – Jun 1, 2020

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 Document how to use pipes and redirection with 'bind'

When my bind command using a pipe did not work, I grepped through the docs for 'pipe' and 'redirection' with no results. Only after I found out in the issues tracker that it was intentional, then I noticed the solution in the examples, too.

Add a paragraph to make it more explicit.

---

This time with proper CCs. Sorry for the noise!

 doc/tigrc.5.adoc | 3 +++
 1 file changed, 3 insertions(+)
doc/tigrc.5.adoc +3 -0
index 630e8f6..1aa8085 100644
@@ -690,6 +690,9 @@ console output shown (as if '!' was specified). When multiple command options
 are specified their behavior are combined, e.g. "?<git commit" will prompt the
 user whether to execute the command and will exit Tig after completion.
 
+Note that if you want to use pipes or redirection in your commands then you
+must run them in a subshell, i.e. embed your commands in `sh -c '<commands>'`.
+
 Browsing state variables
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
Signature · 1 line
2.20.1
#1 lore raw

PATCH RESEND 2/2 Drop unneeded '!' in docs

Since commit 99d8d00 ("User-defined commands no longer need to be prefixed with '!'"), we don't need it anymore. Also, remove a superfluous comment.

---

This time with proper CCs. Sorry for the noise!

 doc/manual.adoc  | 2 +-
 doc/tigrc.5.adoc | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
doc/manual.adoc +1 -1
index cf87ba1..0d772ea 100644
@@ -208,7 +208,7 @@ Example user-defined commands:
 
  - Copy commit ID to clipboard:
 
-	bind generic 9 !@sh -c "echo -n %(commit) | xclip -selection c"
+	bind generic 9 @sh -c "echo -n %(commit) | xclip -selection c"
 
  - Add/edit notes for the current commit used during a review:
 
doc/tigrc.5.adoc +1 -2
index 1aa8085..6b40afe 100644
@@ -780,8 +780,7 @@ file:
 	gitk-bg = !"gitk HEAD --not $(git rev-parse --remotes) &"
 	publish = !"for i in origin public; do git push $i; done"
 [tig "bind"]
-	# @-prefix means that the console output will not be shown.
-	generic = V !@git gitk-bg
+	generic = V @git gitk-bg
 	generic = > !git publish
 --------------------------------------------------------------------------
 
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH RESEND tig 2/2] Drop unneeded '!' in docs

Quoted 4 lines · Wolfram Sang

Since commit 99d8d00 ("User-defined commands no longer need to be prefixed with '!'"), we don't need it anymore. Also, remove a superfluous comment.

Thanks a lot for the two doc improvements!

Signature · 1 line
Jonas Fonseca