瀏覽代碼

Rename '--only' => '--no-deps'

Signed-off-by: Chris Corbyn <[email protected]>
Chris Corbyn 11 年之前
父節點
當前提交
0fc9cc65d1
共有 3 個文件被更改,包括 19 次插入19 次删除
  1. 2 2
      docs/cli.md
  2. 12 12
      fig/cli/main.py
  3. 5 5
      tests/integration/cli_test.py

+ 2 - 2
docs/cli.md

@@ -53,9 +53,9 @@ Links are also created between one-off commands and the other containers for tha
 
 
     $ fig run db /bin/sh -c "psql -h \$DB_1_PORT_5432_TCP_ADDR -U docker"
     $ fig run db /bin/sh -c "psql -h \$DB_1_PORT_5432_TCP_ADDR -U docker"
 
 
-If you do not want linked containers to be started when running the one-off command, specify the `--only` flag:
+If you do not want linked containers to be started when running the one-off command, specify the `--no-deps` flag:
 
 
-    $ fig run --only web python manage.py shell
+    $ fig run --no-deps web python manage.py shell
 
 
 ## scale
 ## scale
 
 

+ 12 - 12
fig/cli/main.py

@@ -204,22 +204,22 @@ class TopLevelCommand(Command):
 
 
         By default, linked services will be started, unless they are already
         By default, linked services will be started, unless they are already
         running. If you do not want to start linked services, use
         running. If you do not want to start linked services, use
-        `fig run --only SERVICE COMMAND [ARGS...]`.
+        `fig run --no-deps SERVICE COMMAND [ARGS...]`.
 
 
         Usage: run [options] SERVICE COMMAND [ARGS...]
         Usage: run [options] SERVICE COMMAND [ARGS...]
 
 
         Options:
         Options:
-            -d      Detached mode: Run container in the background, print new
-                    container name.
-            -T      Disable pseudo-tty allocation. By default `fig run`
-                    allocates a TTY.
-            --rm    Remove container after run. Ignored in detached mode.
-            --only  Don't start linked services.
+            -d         Detached mode: Run container in the background, print
+                       new container name.
+            -T         Disable pseudo-tty allocation. By default `fig run`
+                       allocates a TTY.
+            --rm       Remove container after run. Ignored in detached mode.
+            --no-deps  Don't start linked services.
         """
         """
 
 
         service = self.project.get_service(options['SERVICE'])
         service = self.project.get_service(options['SERVICE'])
 
 
-        if not options['--only']:
+        if not options['--no-deps']:
             self.project.up(
             self.project.up(
                 service_names=service.get_linked_names(),
                 service_names=service.get_linked_names(),
                 start_links=True,
                 start_links=True,
@@ -309,14 +309,14 @@ class TopLevelCommand(Command):
         Usage: up [options] [SERVICE...]
         Usage: up [options] [SERVICE...]
 
 
         Options:
         Options:
-            -d         Detached mode: Run containers in the background,
-                       print new container names.
-            --only     Don't start linked services.
+            -d             Detached mode: Run containers in the background,
+                           print new container names.
+            --no-deps      Don't start linked services.
             --no-recreate  If containers already exist, don't recreate them.
             --no-recreate  If containers already exist, don't recreate them.
         """
         """
         detached = options['-d']
         detached = options['-d']
 
 
-        start_links = not options['--only']
+        start_links = not options['--no-deps']
         recreate = not options['--no-recreate']
         recreate = not options['--no-recreate']
         service_names = options['SERVICE']
         service_names = options['SERVICE']
 
 

+ 5 - 5
tests/integration/cli_test.py

@@ -51,7 +51,7 @@ class CLITestCase(DockerClientTestCase):
         service = self.command.project.get_service('simple')
         service = self.command.project.get_service('simple')
         another = self.command.project.get_service('another')
         another = self.command.project.get_service('another')
         self.assertEqual(len(service.containers()), 1)
         self.assertEqual(len(service.containers()), 1)
-        self.assertEqual(len(another.containers()), 0)
+        self.assertEqual(len(another.containers()), 1)
 
 
     def test_up_with_links(self):
     def test_up_with_links(self):
         self.command.base_dir = 'tests/fixtures/links-figfile'
         self.command.base_dir = 'tests/fixtures/links-figfile'
@@ -63,9 +63,9 @@ class CLITestCase(DockerClientTestCase):
         self.assertEqual(len(db.containers()), 1)
         self.assertEqual(len(db.containers()), 1)
         self.assertEqual(len(console.containers()), 0)
         self.assertEqual(len(console.containers()), 0)
 
 
-    def test_up_with_no_links(self):
+    def test_up_with_no_deps(self):
         self.command.base_dir = 'tests/fixtures/links-figfile'
         self.command.base_dir = 'tests/fixtures/links-figfile'
-        self.command.dispatch(['up', '-d', '--only', 'web'], None)
+        self.command.dispatch(['up', '-d', '--no-deps', 'web'], None)
         web = self.command.project.get_service('web')
         web = self.command.project.get_service('web')
         db = self.command.project.get_service('db')
         db = self.command.project.get_service('db')
         console = self.command.project.get_service('console')
         console = self.command.project.get_service('console')
@@ -114,11 +114,11 @@ class CLITestCase(DockerClientTestCase):
         self.assertEqual(len(console.containers()), 0)
         self.assertEqual(len(console.containers()), 0)
 
 
     @patch('sys.stdout', new_callable=StringIO)
     @patch('sys.stdout', new_callable=StringIO)
-    def test_run_with_no_links(self, mock_stdout):
+    def test_run_with_no_deps(self, mock_stdout):
         mock_stdout.fileno = lambda: 1
         mock_stdout.fileno = lambda: 1
 
 
         self.command.base_dir = 'tests/fixtures/links-figfile'
         self.command.base_dir = 'tests/fixtures/links-figfile'
-        self.command.dispatch(['run', '--only', 'web', '/bin/true'], None)
+        self.command.dispatch(['run', '--no-deps', 'web', '/bin/true'], None)
         db = self.command.project.get_service('db')
         db = self.command.project.get_service('db')
         self.assertEqual(len(db.containers()), 0)
         self.assertEqual(len(db.containers()), 0)