def main()

in configTools/src/main/scala/com/gu/janus/VerifyJanusData.scala [11:40]


  def main(args: Array[String]): Unit = {
    args.headOption.fold {
      Console.err.println(s"""${RED}Error: Missing argument <input file>
           |
           |Usage: run <input file>$RESET""".stripMargin)
      System.exit(1)
    } { fileName =>
      try {
        val file = new File(fileName)
        if (file.exists()) {
          JanusConfig.load(file)
          println(s"""${GREEN}JanusData was loaded$RESET""".stripMargin)
        } else {
          Console.err.println(
            s"""$RED$fileName does not exist$RESET""".stripMargin
          )
          System.exit(1)
        }
      } catch {
        case e: JanusConfigurationException =>
          Console.err.println(s"""$RED${e.getMessage}$RESET""".stripMargin)
          System.exit(1)
        case NonFatal(e) =>
          Console.err.println(
            s"""${RED}Error loading JanusData: ${e.getMessage}$RESET""".stripMargin
          )
          System.exit(1)
      }
    }
  }