Revision: 2759
http://tmux.svn.sourceforge.net/tmux/?rev=2759&view=rev
Author: tcunha
Date: 2012-03-29 21:10:10 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Sync OpenBSD patchset 1079:
Accept an argument to show-environment to show one variable, based on a
diff from Kazuhiko Sakaguchi.
Modified Paths:
--------------
trunk/cmd-show-environment.c
trunk/tmux.1
Modified: trunk/cmd-show-environment.c
===================================================================
--- trunk/cmd-show-environment.c 2012-03-29 21:09:19 UTC (rev 2758)
+++ trunk/cmd-show-environment.c 2012-03-29 21:10:10 UTC (rev 2759)
@@ -31,8 +31,8 @@
const struct cmd_entry cmd_show_environment_entry = {
"show-environment", "showenv",
- "gt:", 0, 0,
- "[-g] " CMD_TARGET_SESSION_USAGE,
+ "gt:", 0, 1,
+ "[-g] " CMD_TARGET_SESSION_USAGE " [name]",
0,
NULL,
NULL,
@@ -55,6 +55,19 @@
env = &s->environ;
}
+ if (args->argc != 0) {
+ envent = environ_find(env, args->argv[0]);
+ if (envent == NULL) {
+ ctx->error(ctx, "unknown variable: %s", args->argv[0]);
+ return (-1);
+ }
+ if (envent->value != NULL)
+ ctx->print(ctx, "%s=%s", envent->name, envent->value);
+ else
+ ctx->print(ctx, "-%s", envent->name);
+ return (0);
+ }
+
RB_FOREACH(envent, environ, env) {
if (envent->value != NULL)
ctx->print(ctx, "%s=%s", envent->name, envent->value);
Modified: trunk/tmux.1
===================================================================
--- trunk/tmux.1 2012-03-29 21:09:19 UTC (rev 2758)
+++ trunk/tmux.1 2012-03-29 21:10:10 UTC (rev 2759)
@@ -2912,12 +2912,16 @@
.It Xo Ic show-environment
.Op Fl g
.Op Fl t Ar target-session
+.Op Ar variable
.Xc
.D1 (alias: Ic showenv )
Display the environment for
.Ar target-session
or the global environment with
.Fl g .
+If
+.Ar variable
+is omitted, all variables are shown.
Variables removed from the environment are prefixed with
.Ql - .
.El
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs