瀏覽代碼

Spike: Add --up option to `fig run`

Signed-off-by: Chris Corbyn <[email protected]>
d11wtq 11 年之前
父節點
當前提交
edf6b56016
共有 1 個文件被更改,包括 10 次插入3 次删除
  1. 10 3
      fig/cli/main.py

+ 10 - 3
fig/cli/main.py

@@ -202,9 +202,10 @@ class TopLevelCommand(Command):
 
             $ fig run web python manage.py shell
 
-        Note that this will not start any services that the command's service
-        links to. So if, for example, your one-off command talks to your
-        database, you will need to run `fig up -d db` first.
+        Note that by default this will not start any services that the
+        command's service links to. So if, for example, your one-off command
+        talks to your database, you will need to either run `fig up -d db`
+        first, or use `fig run --up SERVICE COMMAND [ARGS...]`.
 
         Usage: run [options] SERVICE COMMAND [ARGS...]
 
@@ -214,7 +215,13 @@ class TopLevelCommand(Command):
             -T    Disable pseudo-tty allocation. By default `fig run`
                   allocates a TTY.
             --rm  Remove container after run. Ignored in detached mode.
+            --up  Also start services that the command's service links to
         """
+
+        if options['--up']:
+            # FIXME: I'm not sure if this is good python form
+            self.up({'-d': True, 'SERVICE': None})
+
         service = self.project.get_service(options['SERVICE'])
 
         tty = True