From 07aa6fbb39b1e30bc1b059b653af1c4e1c84017e Mon Sep 17 00:00:00 2001 From: SgStapleton Date: Wed, 24 Apr 2019 16:30:58 -0700 Subject: [PATCH] Adding tab completion for tcsh on conda activation --- isis/scripts/isis3VarInit.py | 2 ++ isis/scripts/tabCompletion.csh | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 isis/scripts/tabCompletion.csh diff --git a/isis/scripts/isis3VarInit.py b/isis/scripts/isis3VarInit.py index adc1ba68bb..2e90ef7521 100755 --- a/isis/scripts/isis3VarInit.py +++ b/isis/scripts/isis3VarInit.py @@ -113,6 +113,8 @@ def mkdir( p ): setenv ISISROOT {} setenv ISIS3DATA {} setenv ISIS3TESTDATA {} + +source $CONDA_PREFIX/scripts/tabCompletion.csh """.format(os.environ['CONDA_PREFIX'], args.data_dir, args.test_dir) a.write(script) print( 'Wrote '+activate_vars_csh ) diff --git a/isis/scripts/tabCompletion.csh b/isis/scripts/tabCompletion.csh new file mode 100644 index 0000000000..28b360e24c --- /dev/null +++ b/isis/scripts/tabCompletion.csh @@ -0,0 +1,25 @@ +#!/bin/csh + + +# Setup tab completion +if ( -f $ISISROOT/bin/isiscomplete ) then + set newBinaries = `/bin/ls $ISISROOT/bin/xml | grep -v qt.conf | sed s%\.xml%%` + set i = 0 + set loop = 0 + set chunk = "" + foreach app ($newBinaries) + @ i = $i + 1 + @ loop = $loop + 1 + set chunk = "$chunk $app" + if ( "$i" == 100 || "$loop" == $#newBinaries) then + eval `$ISISROOT/bin/isiscomplete $chunk` + set i = 1 + set chunk = "" + endif + end + unset i + unset loop + unset chunk + unset app + unset newBinaries +endif