--package it is a 'package PKG' block.
--package PKG Scope the --cabal stanza to the single package PKG. Only
meaningful together with --cabal.
+ --haddock Also emit a -haddock ghc-option. The plugin only captures
+ Haddock comments (class/instance/family docs in the side
+ panel) when the target is compiled with -haddock, so add
+ this if you want documentation in the graph.
-h, --help Show this help and exit.
Environment:
DIR=.classgraph
EMIT=raw # raw | cabal
PACKAGE=
+HADDOCK= # non-empty → also emit -haddock
while [ $# -gt 0 ]; do
case "$1" in
--dir) DIR=$2; shift 2 ;;
--cabal) EMIT=cabal; shift ;;
--package) PACKAGE=$2; shift 2 ;;
+ --haddock) HADDOCK=1; shift ;;
-h|--help) usage; exit 0 ;;
*)
echo "$PROG: unknown argument: $1" >&2
case "$EMIT" in
raw)
+ # Each ghc-option on its own line so the output can be pasted/sourced
+ # token by token.
+ [ -n "$HADDOCK" ] && echo "-haddock"
echo "$RAW_FLAG"
;;
cabal)
if [ -n "$PACKAGE" ]; then
- printf 'package %s\n ghc-options:\n %s\n' "$PACKAGE" "$CABAL_FLAG"
+ echo "package $PACKAGE"
else
- printf 'program-options\n ghc-options:\n %s\n' "$CABAL_FLAG"
+ echo "program-options"
fi
+ echo " ghc-options:"
+ [ -n "$HADDOCK" ] && echo " -haddock"
+ echo " $CABAL_FLAG"
;;
esac