Factor out shared emulator args

Change-Id: Id1416ff8383a6446d3325c41ca45fc03af102871
diff --git a/src/lib.rs b/src/lib.rs
index 4e59180..88a9359 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -732,8 +732,24 @@
 static MAKE_PACKAGE: &str = "make-package";
 static BINARY_PATH: &str = "binary-path";
 
+/// Arguments which configure the startup of an emulator.
+///
+/// Used when `start`ing or `restart`ing.
+fn emulator_args() -> Vec<Arg<'static, 'static>> {
+    vec![
+        Arg::with_name(GRAPHICS).short("g").help("Start a simulator with graphics enabled"),
+        Arg::with_name(DISABLE_VIRTCON)
+            .long(DISABLE_VIRTCON)
+            .help("Do not launch the virtual console service if this option is present"),
+        Arg::with_name(NO_NET).long(NO_NET).help("Don't set up networking."),
+        Arg::with_name(FX_RUN_PARAMS).index(1).multiple(true),
+    ]
+}
+
 #[doc(hidden)]
 pub fn run() -> Result<(), Error> {
+    let emulator_args = emulator_args();
+
     let global_matches = App::new("fargo")
         .version("v0.2.0")
         .setting(AppSettings::GlobalVersion)
@@ -982,20 +998,7 @@
         )
         .subcommand(SubCommand::with_name("list-devices").about("List visible Fuchsia devices"))
         .subcommand(
-            SubCommand::with_name(START)
-                .about("Start a Fuchsia emulator")
-                .arg(
-                    Arg::with_name(GRAPHICS)
-                        .short("g")
-                        .help("Start a simulator with graphics enabled"),
-                )
-                .arg(
-                    Arg::with_name(DISABLE_VIRTCON).long(DISABLE_VIRTCON).help(
-                        "Do not launch the virtual console service if this option is present",
-                    ),
-                )
-                .arg(Arg::with_name(NO_NET).long(NO_NET).help("Don't set up networking."))
-                .arg(Arg::with_name(FX_RUN_PARAMS).index(1).multiple(true)),
+            SubCommand::with_name(START).about("Start a Fuchsia emulator").args(&emulator_args),
         )
         .subcommand(SubCommand::with_name("stop").about("Stop all Fuchsia emulators"))
         .subcommand(
@@ -1005,18 +1008,7 @@
         .subcommand(
             SubCommand::with_name(RESTART)
                 .about("Stop all Fuchsia emulators and start a new one")
-                .arg(
-                    Arg::with_name(GRAPHICS)
-                        .short("g")
-                        .help("Start a simulator with graphics enabled"),
-                )
-                .arg(
-                    Arg::with_name(DISABLE_VIRTCON).long(DISABLE_VIRTCON).help(
-                        "Do not launch the virtual console service if this option is present",
-                    ),
-                )
-                .arg(Arg::with_name(NO_NET).long(NO_NET).help("Don't set up networking."))
-                .arg(Arg::with_name(FX_RUN_PARAMS).index(1).multiple(true)),
+                .args(&emulator_args),
         )
         .subcommand(
             SubCommand::with_name("ssh").about("Open a shell on Fuchsia device or emulator"),