From 78fb8aaccf960c48a6b3b51794af6d28b87b9866 Mon Sep 17 00:00:00 2001 From: dana Date: Fri, 12 Apr 2019 14:00:19 -0500 Subject: [PATCH] 44198: Add cd_silent option to suppress all cd output --- ChangeLog | 5 +++++ Doc/Zsh/options.yo | 15 +++++++++++++++ Src/builtin.c | 4 ++-- Src/options.c | 1 + Src/zsh.h | 1 + 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d0d32063b..740147507 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-04-12 dana + + * 44198: Doc/Zsh/options.yo, Src/builtin.c, Src/options.c, + Src/zsh.h: Add cd_silent option to suppress all cd output + 2019-04-10 Peter Stephenson * Eric Freese: 44214: Src/exec.c: <(...) substitutions shouldn't diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index bc182eb7b..903c31134 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -88,6 +88,21 @@ tt(AUTO_CD) option set) is not a directory, and does not begin with a slash, try to expand the expression as if it were preceded by a `tt(~)' (see noderef(Filename Expansion)). ) +pindex(CD_SILENT) +pindex(NO_CD_SILENT) +pindex(CDSILENT) +pindex(NOCDSILENT) +cindex(cd, silencing) +cindex(autocd, silencing) +item(tt(CD_SILENT))( +Never print the working directory after a tt(cd) (whether explicit or +implied with the tt(AUTO_CD) option set). tt(cd) normally prints the +working directory when the argument given to it was tt(-), a stack entry, or +the name of a directory found under tt(CDPATH). Note that this is distinct +from tt(pushd)'s stack-printing behaviour, which is controlled by +tt(PUSHD_SILENT). This option overrides the printing-related effects of +tt(POSIX_CD). +) pindex(CHASE_DOTS) pindex(NO_CHASE_DOTS) pindex(CHASEDOTS) diff --git a/Src/builtin.c b/Src/builtin.c index 8dcdcc024..49f017046 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -720,7 +720,7 @@ bin_set(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) /**** directory-handling builtins ****/ /**/ -int doprintdir = 0; /* set in exec.c (for autocd) */ +int doprintdir = 0; /* set in exec.c (for autocd, cdpath, etc.) */ /* pwd: display the name of the current directory */ @@ -1251,7 +1251,7 @@ cd_new_pwd(int func, LinkNode dir, int quiet) if (func != BIN_CD && isset(INTERACTIVE)) { if (unset(PUSHDSILENT) && !quiet) printdirstack(); - } else if (doprintdir) { + } else if (unset(CDSILENT) && doprintdir) { fprintdir(pwd, stdout); putchar('\n'); } diff --git a/Src/options.c b/Src/options.c index 600b649e4..48c14c179 100644 --- a/Src/options.c +++ b/Src/options.c @@ -108,6 +108,7 @@ static struct optname optns[] = { {{NULL, "cbases", 0}, CBASES}, {{NULL, "cprecedences", OPT_EMULATE|OPT_NONZSH}, CPRECEDENCES}, {{NULL, "cdablevars", OPT_EMULATE}, CDABLEVARS}, +{{NULL, "cdsilent", 0}, CDSILENT}, {{NULL, "chasedots", OPT_EMULATE}, CHASEDOTS}, {{NULL, "chaselinks", OPT_EMULATE}, CHASELINKS}, {{NULL, "checkjobs", OPT_EMULATE|OPT_ZSH}, CHECKJOBS}, diff --git a/Src/zsh.h b/Src/zsh.h index 10897372b..fc3ed2127 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -2348,6 +2348,7 @@ enum { CASEMATCH, CBASES, CDABLEVARS, + CDSILENT, CHASEDOTS, CHASELINKS, CHECKJOBS,