* [PATCH 1/3] zshexpn: Describe parameter elision and add some introductory prose
@ 2020-01-12 22:29 Daniel Shahaf
2020-01-12 22:29 ` [PATCH 2/3] _git: Complete bisect/new as well as bisect/bad Daniel Shahaf
2020-01-12 22:29 ` [PATCH 3/3] _git: Complete --contains after -r (--remotes) Daniel Shahaf
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Shahaf @ 2020-01-12 22:29 UTC (permalink / raw)
To: zsh-workers
---
The three patches in this series are independent of each other.
Cheers,
Daniel
Doc/Zsh/expn.yo | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 9451fa605..c129b4228 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -582,7 +582,25 @@ and subscript notation to access individual array elements.
Note in particular the fact that words of unquoted parameters are not
automatically split on whitespace unless the option tt(SH_WORD_SPLIT) is
set; see references to this option below for more details. This is an
-important difference from other shells.
+important difference from other shells. However, as in other shells,
+null words are elided from unquoted parameters' expansions.
+
+With default options, after the assignments:
+
+example(array=("first word" "" "third word")
+scalar="only word")
+
+then tt($array) substitutes two words, `tt(first word)' and `tt(third
+word)', and tt($scalar) substitutes a single word `tt(only word)'. Note
+that second element of tt(array) was elided. Scalar parameters can
+be elided too if their value is null (empty). To avoid elision, use quoting as
+follows: tt("$scalar") for scalars and tt("${array[@]}") or tt("${(@)array}")
+for arrays. (The last two forms are equivalent.)
+
+Parameter expansions can involve em(flags), as in `tt(${(@kv)aliases})',
+and other operators, such as `tt(${PREFIX:-"/usr/local"})'. Parameter
+expansions can also be nested. These topics will be introduced below.
+The full rules are complicated and are noted at the end.
In the expansions discussed below that require a pattern, the form of
the pattern is the same as that used for filename generation;
@@ -594,17 +612,8 @@ noderef(Modifiers) in noderef(History Expansion) can be
applied: for example, tt(${i:s/foo/bar/}) performs string
substitution on the expansion of parameter tt($i).
-In the following descriptions, `word' refers to a single word
+In the following descriptions, `var(word)' refers to a single word
substituted on the command line, not necessarily a space delimited word.
-With default options, after the assignments:
-
-example(array=("first word" "second word")
-scalar="only word")
-
-then tt($array) substitutes two words, `tt(first word)' and `tt(second
-word)', and tt($scalar) substitutes a single word `tt(only word)'. This
-may be modified by explicit or implicit word-splitting, however. The
-full rules are complicated and are noted at the end.
startitem()
item(tt(${)var(name)tt(}))(
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] _git: Complete bisect/new as well as bisect/bad.
2020-01-12 22:29 [PATCH 1/3] zshexpn: Describe parameter elision and add some introductory prose Daniel Shahaf
@ 2020-01-12 22:29 ` Daniel Shahaf
2020-01-12 22:29 ` [PATCH 3/3] _git: Complete --contains after -r (--remotes) Daniel Shahaf
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2020-01-12 22:29 UTC (permalink / raw)
To: zsh-workers
Also, complete the bisect/old-$commithash ref names.
---
I'm not sure if completing the bisect/old-* ref names is actually
useful; the completion offers no information on their position in the
bisect trace, just the commit hash.
Completion/Unix/Command/_git | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 7f2c206c1..8e0d57789 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -6709,14 +6709,12 @@ __git_heads_local () {
local f gitdir
declare -a heads
- heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"})
+ heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads refs/bisect refs/stash 2>/dev/null)"})
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
if __git_command_successful $pipestatus; then
for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
[[ -f $gitdir/$f ]] && heads+=$f
done
- [[ -f $gitdir/refs/stash ]] && heads+=stash
- [[ -f $gitdir/refs/bisect/bad ]] && heads+=bisect/bad
fi
__git_describe_commit heads heads-local "local head" "$@"
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] _git: Complete --contains after -r (--remotes).
2020-01-12 22:29 [PATCH 1/3] zshexpn: Describe parameter elision and add some introductory prose Daniel Shahaf
2020-01-12 22:29 ` [PATCH 2/3] _git: Complete bisect/new as well as bisect/bad Daniel Shahaf
@ 2020-01-12 22:29 ` Daniel Shahaf
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2020-01-12 22:29 UTC (permalink / raw)
To: zsh-workers
---
This one I'm not so sure about. I wanted to make «git branch -r --cont<TAB>»
complete the option name and arguments to it, and that part works, but
the way in which those single-letter variable names are used in the
_arguments specs is pretty undecipherable. Does this patch seem
obviously right, or obviously wrong, to anyone? If not, I'll test it
for a while and commit it to the 5.9 branch if I don't find any obvious
showstopper. (But I don't use «git branch» that frequently, so perhaps
it'll be better if I committed this to 5.9 directly…?)
Cheers,
Daniel
Completion/Unix/Command/_git | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 8e0d57789..d503b1134 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -282,9 +282,13 @@ _git-bisect () {
_git-branch () {
declare l c m d e
+ # listing branches
- l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev -l --list --points-at --sort'
+ l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev -l --list --points-at --sort --contains --no-contains'
+ # creating branches
- c='--create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged'
+ c='--create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --merged --no-merged'
+ # modifying branches
m='-c --copy -C -m --move -M --edit-description --show-current'
+ # deleting branches
d='-d --delete -D'
declare -a dependent_creation_args
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-12 22:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-12 22:29 [PATCH 1/3] zshexpn: Describe parameter elision and add some introductory prose Daniel Shahaf
2020-01-12 22:29 ` [PATCH 2/3] _git: Complete bisect/new as well as bisect/bad Daniel Shahaf
2020-01-12 22:29 ` [PATCH 3/3] _git: Complete --contains after -r (--remotes) Daniel Shahaf
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).