diff --git a/README.md b/README.md index ec0e23fbf..7e0576e85 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Options: -v, --verbosity The verbosity of output. Allowed values: q[uiet], n[ormal], d[etailed] -p, --prob-specs-dir Use this `problem-specifications` directory, rather than cloning temporarily -o, --offline Do not check that the directory specified by `-p, --prob-specs-dir` is up-to-date + -t, --track-dir Specify a track directory to use instead of the current directory -h, --help Show this help message and exit --version Show this tool's version information and exit ``` diff --git a/src/cli.nim b/src/cli.nim index 72ca3b386..f15458603 100644 --- a/src/cli.nim +++ b/src/cli.nim @@ -19,6 +19,7 @@ type verbosity*: Verbosity probSpecsDir*: string offline*: bool + trackDir*: string Opt = enum optExercise = "exercise" @@ -27,6 +28,7 @@ type optVerbosity = "verbosity" optProbSpecsDir = "probSpecsDir" optOffline = "offline" + optTrackDir = "trackDir" optHelp = "help" optVersion = "version" @@ -95,6 +97,7 @@ Options: {list(optVerbosity)} The verbosity of output. {allowedValues(Verbosity)} {list(optProbSpecsDir)} Use this `problem-specifications` directory, rather than cloning temporarily {list(optOffline)} Do not check that the directory specified by `{list(optProbSpecsDir)}` is up-to-date + {list(optTrackDir)} Specify a track directory to use instead of the current directory {list(optHelp)} Show this help message and exit {list(optVersion)} Show this tool's version information and exit""" @@ -124,6 +127,7 @@ proc initConf: Conf = verbosity: verNormal, probSpecsDir: "", offline: false, + trackDir: "", ) func normalizeOption(s: string): string = @@ -196,6 +200,8 @@ proc processCmdLine*: Conf = result.probSpecsDir = val of optOffline: result.offline = true + of optTrackDir: + result.trackDir = val of optHelp: showHelp() of optVersion: diff --git a/src/tracks.nim b/src/tracks.nim index af55b85de..539ed875b 100644 --- a/src/tracks.nim +++ b/src/tracks.nim @@ -83,5 +83,9 @@ proc findTrackExercises(repo: TrackRepo, conf: Conf): seq[TrackExercise] = result.add(newTrackExercise(repoExercise)) proc findTrackExercises*(conf: Conf): seq[TrackExercise] = - let trackRepo = newTrackRepo() + let trackRepo = + if conf.trackDir.len > 0: + TrackRepo(dir: conf.trackDir) + else: + newTrackRepo() trackRepo.findTrackExercises(conf)