daml/dev-env/bin/da-ghcid

43 lines
1.1 KiB
Plaintext
Raw Normal View History

2019-04-04 11:33:38 +03:00
#!/usr/bin/env python3
#
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2019-04-04 11:33:38 +03:00
# SPDX-License-Identifier: Apache-2.0
"""Bazel aware wrapper for ghcid
Calls ghcid on da-ghci on the given target. See da-ghci --help for further information.
To pass additional arguments to da-ghci use the following form:
da-ghcid //my:target -- -package extra-package
2019-04-04 11:33:38 +03:00
"""
import argparse
import subprocess
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--data",
action="store",
dest="data",
choices=["yes","no"],
help="Whether to load data dependencies into the REPL.")
args, remainingArgs = parser.parse_known_args()
if args.data == None:
ghciCmd = "da-ghci"
else:
ghciCmd = f"da-ghci --data {args.data}"
try:
subprocess.call(["ghcid","-c",ghciCmd] + remainingArgs)
except KeyboardInterrupt:
return # don't give a trace back, just exit
if __name__ == "__main__":
main()