[isabelle] Command completion for Isabelle



Hi all,

if you want to have rudimentary command completion for Isabelle in bash,
source the attached script in your ~/.bashrc.

If there are enough enthusiasts, I could incorporate this into the
distribution.

I do not recommend anybody to dive into this command completion
business, e.g. this bulk is needed

  if (( ${COMP_CWORD} == 1 ))
  then
    […]
  else
    cur="${CURRENT}" && _filedir
  fi

just to recover the well-known behaviour of directory-sensitive filename
expansion for the different subcommands.

And the steps for installing are not really modular.

Cheers,
	Florian

-- 

PGP available:
http://home.informatik.tu-muenchen.de/haftmann/pgp/florian_haftmann_at_informatik_tu_muenchen_de
function _isabelle {

  local CURRENT="${COMP_WORDS[${COMP_CWORD}]}"

  if (( ${COMP_CWORD} == 1 ))
  then
    local CURRENT="${COMP_WORDS[${COMP_CWORD}]}"
    local ISABELLE_TOOL="${COMP_WORDS[0]}"
    local ISABELLE_HOME="$("${ISABELLE_TOOL}" getenv -b ISABELLE_HOME)"
    local ISABELLE_TOOLS="$("${ISABELLE_TOOL}" getenv -b ISABELLE_TOOLS)"
    {
      export ISABELLE_TOOLS
      local ISABELLE_TOOLS_ALL=($(perl -w "${ISABELLE_HOME}/lib/scripts/tools.pl" | perl -pe 's/^\s+(\S+)\s.*$/$1/g'))
      declare +x ISABELLE_TOOLS
    }
    COMPREPLY=($(compgen -W "${ISABELLE_TOOLS_ALL[*]}" "${CURRENT}"))
  else
    cur="${CURRENT}" && _filedir
  fi
}

complete -o filenames -F _isabelle isabelle

Attachment: signature.asc
Description: OpenPGP digital signature



This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.