Last active
September 18, 2015 19:58
-
-
Save trane/3ee429d22175727eae92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.twitter.app._ | |
| import java.net.InetSocketAddress | |
| object Main extends App { | |
| // set default values for this flag, if it isn't passed in at command line | |
| val memcachedF = flag("memcached", Seq(new InetSocketAddress(0)), "memcached addresses") | |
| // print out the current value of the memcached flag (at this point, it's just the default value) | |
| println(s"1. memcacheds from defaults: ${memcachedF()}") | |
| /** | |
| * the method that runs when we call "run" | |
| * it will pass the cli args through the initialized parser and update the flag values | |
| */ | |
| def main : Unit = | |
| println(s"2. memcacheds from args ${memcachedF()}") | |
| } | |
| > run -memcached=localhost:11211,10.2.2.1:11211 | |
| 1. memcacheds from defaults: List(0.0.0.0/0.0.0.0:0) | |
| 2. memcacheds from args ArraySeq(localhost/127.0.0.1:11211, /10.2.2.1:11211) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment