daml/dev-env/bin/da-ghcid
Gary Verhaegen ea55ea2d14
Further copyright updates (#12249)
Somewhat error-prone, so please review carefully.

Reasons we need this:

- Some file types are not properly handled by the script.
- The only exclusion mechanism we currently have (`NO_AUTO_COPYRIGHT`)
  is overly coarse.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-04 16:32:17 +01:00

43 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
#
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# 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
"""
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()