Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an optional baseDirectory parameter to run() #278

Merged
merged 2 commits into from
Mar 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,14 +27,14 @@ 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
} match {
case (params, options) =>
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 @@ -48,6 +48,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