Sha256: 2f7403967ab06b67befb8649b7dbbbd5ec43e7cf3cc8275c65e5850abfba0880

Contents?: true

Size: 1.7 KB

Versions: 109

Compression:

Stored size: 1.7 KB

Contents

open Core
open Languages

let is_directory =
  Command.Spec.Arg_type.create
    (fun n ->
       match Sys.is_directory n with
       | `Yes -> n
       | `No | `Unknown ->
         eprintf "'%s' is not a regular folder.\n%!" n;
         exit 1
    )

let home_dir = Option.value_exn (Sys.getenv "HOME")

let default_generated name = Option.value ~default:(home_dir ^ "/.x" ^ name ^ "-generated")

let command =
  Command.basic
    ~summary:"Generates test code from canonical data."
    Command.Spec.(
      empty
      +> flag "-l" (optional string) ~doc:"language to generate tests for"
      +> flag "-t" (optional_with_default "./templates" is_directory) ~doc:"string Directory containing templates."
      +> flag "-c" (optional_with_default "../../../problem-specifications/exercises" is_directory) ~doc:"string Directory containing canonical data."
      +> flag "-o" (optional string) ~doc:"string Directory to output generated tests."
      +> flag "-g" (optional string) ~doc:"string Directory to backup generated tests."
      +> flag "-f" (optional string) ~doc:"string Filter out files not matching this string."
    )
    (fun language templates_folder canonical_data_folder output_folder generated_folder filter () -> 
      let language = Option.value language ~default:"ocaml" in
      let lc = default_language_config language in
      let generated_folder = default_generated language generated_folder in
      let templates_folder = templates_folder ^ "/" ^ language in
      let output_folder = Option.value output_folder ~default:(lc.default_base_folder ^ "/exercises") in
      Controller.run lc templates_folder canonical_data_folder output_folder generated_folder filter)

let () =
  Command.run ~version:"0.1" command

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
trackler-2.2.1.100 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.99 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.98 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.97 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.96 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.95 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.94 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.93 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.92 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.91 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.90 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.89 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.88 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.87 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.86 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.85 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.84 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.83 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.82 tracks/ocaml/tools/test-generator/src/test_gen.ml
trackler-2.2.1.81 tracks/ocaml/tools/test-generator/src/test_gen.ml