|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#!/bin/bash
# This file:
# http://angg.twu.net/bin/eev-cabal.html
# http://angg.twu.net/bin/eev-cabal
# (find-angg "bin/eev-cabal")
# Author: Eduardo Ochs <eduardoochs@gmail.com>
# Version: 2022sep20
#
# This script is used by:
# (find-angg ".emacs.templates" "find-cabal-links")
# (find-angg ".emacs.templates" "find-cabal-unpack")
# Tests:
# (find-cabal-links)
# (find-cabal-links "hoogle")
#
# (defun e () (interactive) (find-angg "bin/eev-cabal"))
ghc_version () { ghc --version | awk '{print $NF}'; }
ghc_store_dir () { echo ~/.cabal/store/ghc-$(ghc_version); }
ghc_store_package_db () { echo ~/.cabal/store/ghc-$(ghc_version)/package.db; }
ghc_pkg_ () { echo ghc-pkg --package-db=$(ghc_store_package_db) $*; }
ghc_pkg () { $(ghc_pkg_) $*; }
ghc_list_ () { $(ghc_pkg_) list $*; }
ghc_list () { $(ghc_pkg_) list $* | head -n -1 | tail -n +2 | awk '{print $1}'; }
ghc_field_ () { ghc_pkg field $*; }
ghc_field () { ghc_pkg field $* | awk '{print $NF}'; }
ghc_describe () { ghc_pkg describe $*; }
cabal_tgz () { echo ~/.cabal/packages/hackage.haskell.org/$1/*/*; }
cabal_tgz_b () { basename $(cabal_tgz $1) .tar.gz; }
usrc_dir () { echo "$HOME/usrc/$(ghc_list $1)"; }
usrc_dir_rm () { $2 rm -Rfv $(usrc_dir $1); }
usrc_dir_unpack () { $2 tar -C ~/usrc/ -xvzf $(cabal_tgz $1); }
eval $*
: <<'%%%%%'
* (eepitch-bash)
* (eepitch-kill)
* (eepitch-bash)
. eev-cabal
echo $(ghc_pkg_ describe hoogle)
ghc_pkg describe hoogle
ghc_field_ hoogle library-dirs
ghc_field hoogle library-dirs
ghc_describe hoogle
echo $(ghc_store_package_db)/hoogle-*
cabal_tgz hoogle
cabal_tgz_b hoogle
* (eepitch-bash)
* (eepitch-kill)
* (eepitch-bash)
. eev-cabal
ghc_list Agda
usrc_dir Agda
usrc_dir_rm Agda echo
usrc_dir_unpack Agda echo
usrc_dir_rm Agda
usrc_dir_unpack Agda
usrc_dir Agda
# (code-c-d "Agda" "~/usrc/Agda-2.6.4.3/")
# (find-Agdafile "")
# (find-man "cut")
# (find-sh "ghc-pkg --help")
# (find-sh "eev-cabal ghc_pkg list")
# (find-sh "eev-cabal ghc_list_")
# (find-sh "eev-cabal ghc_list")
# (find-sh "eev-cabal ghc_field_ hoogle library-dirs")
# (find-sh "eev-cabal ghc_describe hoogle")
# (find-sh "eev-cabal ghc_field hoogle library-dirs")
%%%%%
# Local Variables:
# coding: utf-8-unix
# End: