tcsh_completion.sh

TK Soh teekaysoh at yahoo.com
Sun Aug 28 19:46:10 CDT 2005


In case anyone wonders, here's the Bourne shell (!!) script for generating the
tcsh completion source.

# HG changeset patch
# User TK Soh <teekaysoh at yahoo.com>
# Node ID 5ea31d77024ff8c57535d7ccea7771ea0ecf610a
# Parent  a33a7a543803c7383a6918b19797bf9fd6b83e8e
added script for generating tcsh completion source

diff -r a33a7a543803 -r 5ea31d77024f contrib/tcsh_completion.sh
--- /dev/null	Sun Aug 28 06:45:27 2005
+++ b/contrib/tcsh_completion.sh	Mon Aug 29 00:45:45 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 options/d; /^ \{0,\}-/!d;' | \
+        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 
 


More information about the Mercurial mailing list