Jelajahi Sumber

[FrameworkBundle] Improving the output and help messages in the task (no behavioral change)

Ryan Weaver 14 tahun lalu
induk
melakukan
91df6d9f5c

+ 18 - 4
src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

@@ -18,7 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Output\Output;
 
 /**
- * AssetsInstallCommand.
+ * Command that places bundle web assets into a given directory.
  *
  * @author Fabien Potencier <fabien@symfony.com>
  */
@@ -31,9 +31,23 @@ class AssetsInstallCommand extends Command
     {
         $this
             ->setDefinition(array(
-                new InputArgument('target', InputArgument::REQUIRED, 'The target directory'),
+                new InputArgument('target', InputArgument::REQUIRED, 'The target directory (usually "web")'),
             ))
             ->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
+            ->setHelp(<<<EOT
+The <info>assets:install</info> command installs bundle assets into a given
+directory (e.g. the web directory).
+
+<info>./app/console assets:install web [--symlink]</info>
+
+A "bundles" directory will be created inside the target directory, and the
+"Resources/public" directory of each bundle will be copied into it.
+
+To create a symlink to each bundle instead of copying its assets, use the
+<info>--symlink</info> option.
+
+EOT
+            )
             ->setName('assets:install')
         ;
     }
@@ -56,10 +70,10 @@ class AssetsInstallCommand extends Command
 
         foreach ($this->container->get('kernel')->getBundles() as $bundle) {
             if (is_dir($originDir = $bundle->getPath().'/Resources/public')) {
-                $output->writeln(sprintf('Installing assets for <comment>%s</comment>', $bundle->getNamespace()));
-
                 $targetDir = $input->getArgument('target').'/bundles/'.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
 
+                $output->writeln(sprintf('Installing assets for <comment>%s</comment> into <comment>%s</comment>', $bundle->getNamespace(), $targetDir));
+
                 $filesystem->remove($targetDir);
 
                 if ($input->getOption('symlink')) {