Allow setting status via command line.

This commit is contained in:
Felix Ableitner 2016-01-24 23:42:56 +01:00
parent dc55d74f9b
commit 6cf8a3c0b8
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,3 @@
package com.nutomic.ensichat.server
case class Config(name: Option[String] = None)
case class Config(name: Option[String] = None, status: Option[String] = None)

View file

@ -40,11 +40,15 @@ object Main extends App with CallbackInterface {
opt[String]('n', "name") action { (x, c) =>
c.copy(name = Option(x))
} text "the username for this node (optional)"
opt[String]('s', "status") action { (x, c) =>
c.copy(status = Option(x))
} text "the status line (optional)"
help("help") text "prints this usage text"
}
parser.parse(args, Config()).foreach { config =>
config.name.foreach(settings.put(SettingsInterface.KeyUserName, _))
config.status.foreach(settings.put(SettingsInterface.KeyUserStatus, _))
run()
}
}