Skip to contentSkip to conversation

tg-push: add bash completion

PATCH New Bert Wesarg 1 participant 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tg-push: add bash completion

---
 contrib/tg-completion.bash |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
contrib/tg-completion.bash +21 -0
index de8a7b5..5b9ef31 100755
@@ -370,6 +370,26 @@ _tg_patch ()
 	esac
 }
 
+_tg_push ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+
+	__tg_complete_arg "-r" && {
+		__tgcomp "$(__tg_remotes)"
+		return
+	}
+
+	case "$cur" in
+	-*)
+		__tgcomp "
+			-r
+		"
+		;;
+	*)
+		__tgcomp "$(__tg_topics)"
+	esac
+}
+
 _tg_remote ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -449,6 +469,7 @@ _tg ()
 	info)        _tg_info ;;
 	mail)        _tg_mail ;;
 	patch)       _tg_patch ;;
+	push)        _tg_push ;;
 	remote)      _tg_remote ;;
 	summary)     _tg_summary ;;
 	update)      _tg_update ;;
Signature · 1 line
tg: (b725fc9..) bw/push-completion (depends on: master)
#1 lore raw

PATCH v2 1/1 tg-push: add bash completion

Include all options.

---
 contrib/tg-completion.bash |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
contrib/tg-completion.bash +24 -0
index de8a7b5..0ee233c 100755
@@ -370,6 +370,29 @@ _tg_patch ()
 	esac
 }
 
+_tg_push ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+
+	__tg_complete_arg "-r" && {
+		__tgcomp "$(__tg_remotes)"
+		return
+	}
+
+	case "$cur" in
+	-*)
+		__tgcomp "
+			--no-deps
+			--dry-run
+			--tgish-only
+			-r
+		"
+		;;
+	*)
+		__tgcomp "$(__tg_topics)"
+	esac
+}
+
 _tg_remote ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -449,6 +472,7 @@ _tg ()
 	info)        _tg_info ;;
 	mail)        _tg_mail ;;
 	patch)       _tg_patch ;;
+	push)        _tg_push ;;
 	remote)      _tg_remote ;;
 	summary)     _tg_summary ;;
 	update)      _tg_update ;;
Signature · 1 line
tg: (b725fc9..) bw/push-completion (depends on: master)
#2 lore raw

Ping.

Regards,
Bert

Quoted 53 lines · Bert Wesarg

Include all options.

---
 contrib/tg-completion.bash |   24 ++++++++++++++++++++++++

 1 files changed, 24 insertions(+), 0 deletions(-)
contrib/tg-completion.bash +0 -0
index de8a7b5..0ee233c 100755
@@ -370,6 +370,29 @@ _tg_patch ()

       esac
 }

contrib/tg-completion.bash +23 -0
+_tg_push ()
+{
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+
+       __tg_complete_arg "-r" && {
+               __tgcomp "$(__tg_remotes)"
+               return
+       }
+
+       case "$cur" in
+       -*)
+               __tgcomp "
+                       --no-deps
+                       --dry-run
+                       --tgish-only
+                       -r
+               "
+               ;;
+       *)
+               __tgcomp "$(__tg_topics)"
+       esac
+}
+

 _tg_remote ()
 {
       local cur="${COMP_WORDS[COMP_CWORD]}"

contrib/tg-completion.bash +1 -1
@@ -449,6 +472,7 @@ _tg ()
        info)        _tg_info ;;
        mail)        _tg_mail ;;
        patch)       _tg_patch ;;
+       push)        _tg_push ;;
        remote)      _tg_remote ;;
        summary)     _tg_summary ;;
        update)      _tg_update ;;
--

tg: (b725fc9..) bw/push-completion (depends on: master)