Skip to content

Commit

Permalink
Merge pull request #310 from foundweekends/wip/278
Browse files Browse the repository at this point in the history
fport: Add an optional baseDirectory parameter to run()
  • Loading branch information
eed3si9n authored Jun 30, 2017
2 parents 8126761 + 0e4565e commit 7995742
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/scala/giter8.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Giter8 extends xsbti.AppMain {
new Exit(Giter8.run(config.arguments))

/** Runner shared my main-class runner */
def run(args: Array[String]): Int = {
def run(args: Array[String], baseDirectory: File): Int = {
val helper = new JgitHelper(new Git(new JGitInteractor), G8TemplateRenderer)
val result = (args.partition { s =>
G8.Param.pattern.matcher(s).matches
Expand All @@ -36,7 +36,7 @@ class Giter8 extends xsbti.AppMain {
parser
.parse(options, Config(""))
.map { config =>
helper.run(config, params, new File("."))
helper.run(config, params, baseDirectory)
}
.getOrElse(Left(""))
case _ => Left(parser.usage)
Expand All @@ -51,6 +51,8 @@ class Giter8 extends xsbti.AppMain {
})
}

def run(args: Array[String]):Int = run(args, (new File(".")).getAbsoluteFile)

val parser = new scopt.OptionParser[Config]("giter8") {
head("g8", giter8.BuildInfo.version)
// cmd("search") action { (_, config) =>
Expand Down

0 comments on commit 7995742

Please sign in to comment.