logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: tcsh_completion.sh: msg#00828

Subject: Re: tcsh_completion.sh
--- TK Soh <teekaysoh@xxxxxxxxx> wrote:
> In case anyone wonders, here's the Bourne shell (!!) script for generating
> the
> tcsh completion source.
> 
> # HG changeset patch
> # User TK Soh <teekaysoh@xxxxxxxxx>
> # Node ID 5ea31d77024ff8c57535d7ccea7771ea0ecf610a
> # Parent  a33a7a543803c7383a6918b19797bf9fd6b83e8e
> added script for generating tcsh completion source

Again, here's the better one.

# HG changeset patch
# User TK Soh <teekaysoh@xxxxxxxxx>
# Node ID 8259c9ab20685c0c9ea858d20095ab5b10e09d94
# Parent  fa74bb9440487434cd01411ce4a69e091fb05bb2
add contrib shell script for generating tcsh completion

diff -r fa74bb944048 -r 8259c9ab2068 contrib/tcsh_completion.sh
--- /dev/null   Mon Aug 29 02:25:32 2005
+++ b/contrib/tcsh_completion.sh        Mon Aug 29 02:26:28 2005
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+#
+# This script generates a tcsh source file to support completion
+# of Mercurial commands and options.
+#
+# Instruction:
+# -----------
+# Run this script to generate the tcsh source file, and source
+# the file to add command completion support for Mercurial.
+#
+#    tcsh% tcsh_completion.sh FILE
+#    tcsh% source FILE
+#
+# If FILE is not specified, tcsh_completion will be generated.
+#
+# BUGS:
+# 1. command specific options are not supported
+# 2. hg commands must be specified immediately after 'hg'.
+#
+
+tcsh_file=${1-tcsh_completion}
+
+hg_commands=`hg --debug help | \
+        sed -e '1,/^list of commands:/d' \
+            -e '/^global options:/,$d' \
+            -e '/^ [^ ]/!d; s/[,:]//g;' | 
+        xargs -n5 | \
+        sed -e '$!s/$/ \\\\/g; 2,$s/^ \{0,\}/    /g'`
+
+hg_global_options=`hg -v help | \
+        sed -e '1,/global/d;/^ *-/!d; s/ [^- ].*//' | \
+        xargs -n5 | \
+        sed -e '$!s/$/ \\\\/g; 2,$s/^ \{0,\}/    /g'`
+
+hg_version=`hg version | sed -e '1q'`
+
+script_name=`basename $0`
+
+cat > $tcsh_file <<END
+#
+# tcsh completion for Mercurial
+#
+# This file has been auto-generated by $script_name for
+# $hg_version 
+#
+
+complete hg \\
+  'n/--cwd/d/' 'n/-R/d/' 'n/--repository/d/' \\
+  'C/-/($hg_global_options)/' \\
+  'p/1/($hg_commands)/'
+
+END



                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 


<Prev in Thread] Current Thread [Next in Thread>