zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] bzr completion: modified files
@ 2014-04-17 19:53 Sebastien Alaiwan
  2014-04-17 19:58 ` Sebastien Alaiwan
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastien Alaiwan @ 2014-04-17 19:53 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 178 bytes --]

Hi there,

here's a patch allowing completing 'bzr commit' and 'bzr revert' with a list of versionned AND modified files (instead of a list of versionned files).

Cheers!


[-- Attachment #1.2: bzr_completion_modified_files.diff --]
[-- Type: text/plain, Size: 989 bytes --]

--- _bzr.back	2014-04-17 21:45:34.664671679 +0200
+++ _bzr	2014-04-17 21:47:51.863895257 +0200
@@ -46,6 +46,14 @@
     return 0
 }
 
+(( $+functions[_bzr_modifiedFiles] )) ||
+_bzr_modifiedFiles() {
+    local fileList
+    fileList=(${(ps:\0:)"$(bzr status . --versioned --short | cut -b 5- | tr '\n' '\0')"})
+    compadd -af fileList
+    return 0
+}
+
 (( $+functions[_bzr_completeParents] )) ||
 _bzr_completeParents() {
     local parentFile=$(bzr root 2>/dev/null)/.bzr/branch/parent
@@ -214,7 +222,7 @@
 	'--unchanged[include unchanged files]'
 	'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
 	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
-	'*:modified files:_bzr_versionedFiles'
+	'*:modified files:_bzr_modifiedFiles'
 	)
     ;;
 
@@ -300,7 +308,7 @@
     args+=(
 	'--no-backup[skip generation of backup~ files]'
 	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
-	'*:file:_bzr_versionedFiles'
+	'*:file:_bzr_modifiedFiles'
 	)
     ;;
 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] bzr completion: modified files
  2014-04-17 19:53 [PATCH] bzr completion: modified files Sebastien Alaiwan
@ 2014-04-17 19:58 ` Sebastien Alaiwan
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastien Alaiwan @ 2014-04-17 19:58 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 275 bytes --]

On 04/17/2014 09:53 PM, Sebastien Alaiwan wrote:
> Hi there,
>
> here's a patch allowing completing 'bzr commit' and 'bzr revert' with a list of versionned AND modified files (instead of a list of versionned files).
Sorry, here's instead a patch version with full path.

[-- Attachment #1.2: bzr_completion_modified_files.diff --]
[-- Type: text/plain, Size: 1117 bytes --]

diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr
index ab9fd72..c28c214 100644
--- a/Completion/Unix/Command/_bzr
+++ b/Completion/Unix/Command/_bzr
@@ -46,6 +46,14 @@ _bzr_versionedFiles() {
     return 0
 }
 
+(( $+functions[_bzr_modifiedFiles] )) ||
+_bzr_modifiedFiles() {
+    local fileList
+    fileList=(${(ps:\0:)"$(bzr status . --versioned --short | cut -b 5- | tr '\n' '\0')"})
+    compadd -af fileList
+    return 0
+}
+
 (( $+functions[_bzr_completeParents] )) ||
 _bzr_completeParents() {
     local parentFile=$(bzr root 2>/dev/null)/.bzr/branch/parent
@@ -214,7 +222,7 @@ case $cmd in
 	'--unchanged[include unchanged files]'
 	'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
 	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
-	'*:modified files:_bzr_versionedFiles'
+	'*:modified files:_bzr_modifiedFiles'
 	)
     ;;
 
@@ -300,7 +308,7 @@ case $cmd in
     args+=(
 	'--no-backup[skip generation of backup~ files]'
 	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
-	'*:file:_bzr_versionedFiles'
+	'*:file:_bzr_modifiedFiles'
 	)
     ;;
 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-17 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 19:53 [PATCH] bzr completion: modified files Sebastien Alaiwan
2014-04-17 19:58 ` Sebastien Alaiwan

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).