Browse Source

[Console] removed the application name in help

Fabien Potencier 15 năm trước cách đây
mục cha
commit
75c922884e

+ 1 - 1
src/Symfony/Components/Console/Application.php

@@ -249,7 +249,7 @@ class Application
       $this->getLongVersion(),
       '',
       '<comment>Usage:</comment>',
-      sprintf("  %s [options] command [arguments]\n", $this->getName()),
+      sprintf("  [options] command [arguments]\n"),
       '<comment>Options:</comment>',
     );
 

+ 2 - 2
src/Symfony/Components/Console/Command/Command.php

@@ -406,7 +406,7 @@ class Command
    */
   public function getSynopsis()
   {
-    return sprintf('%%s %s %s', $this->getFullName(), $this->definition->getSynopsis());
+    return sprintf('%s %s', $this->getFullName(), $this->definition->getSynopsis());
   }
 
   /**
@@ -432,7 +432,7 @@ class Command
   {
     $messages = array(
       '<comment>Usage:</comment>',
-      sprintf(' '.$this->getSynopsis(), null === $this->application ? '' : $this->application->getName()),
+      ' '.$this->getSynopsis(),
       '',
     );
 

+ 1 - 1
tests/fixtures/Symfony/Components/Console/application_astext1.txt

@@ -1,7 +1,7 @@
 <info>Console Tool</info>
 
 <comment>Usage:</comment>
-  UNKNOWN [options] command [arguments]
+  [options] command [arguments]
 
 <comment>Options:</comment>
   <info>--help</info>      <info>-h</info>  Display this help message.

+ 1 - 1
tests/fixtures/Symfony/Components/Console/application_astext2.txt

@@ -1,7 +1,7 @@
 <info>Console Tool</info>
 
 <comment>Usage:</comment>
-  UNKNOWN [options] command [arguments]
+  [options] command [arguments]
 
 <comment>Options:</comment>
   <info>--help</info>      <info>-h</info>  Display this help message.

+ 3 - 3
tests/fixtures/Symfony/Components/Console/application_asxml1.txt

@@ -2,7 +2,7 @@
 <symfony>
   <commands>
     <command id="help" namespace="_global" name="help">
-  <usage> help [--xml] [command_name]</usage>
+  <usage>help [--xml] [command_name]</usage>
   <description>Displays help for a command</description>
   <help>The &lt;info&gt;help&lt;/info&gt; command displays help for a given command:
  
@@ -29,7 +29,7 @@
   </options>
 </command>
     <command id="list" namespace="_global" name="list">
-  <usage> list [--xml] [namespace]</usage>
+  <usage>list [--xml] [namespace]</usage>
   <description>Lists commands</description>
   <help>The &lt;info&gt;list&lt;/info&gt; command lists all commands:
  
@@ -56,7 +56,7 @@
   </options>
 </command>
     <command id="foo:bar" namespace="foo" name="bar">
-  <usage> foo:bar </usage>
+  <usage>foo:bar </usage>
   <description>The foo:bar command</description>
   <help/>
   <aliases>

+ 1 - 1
tests/fixtures/Symfony/Components/Console/application_asxml2.txt

@@ -2,7 +2,7 @@
 <symfony>
   <commands namespace="foo">
     <command id="foo:bar" namespace="foo" name="bar">
-  <usage> foo:bar </usage>
+  <usage>foo:bar </usage>
   <description>The foo:bar command</description>
   <help/>
   <aliases>

+ 1 - 1
tests/fixtures/Symfony/Components/Console/application_gethelp.txt

@@ -1,7 +1,7 @@
 <info>Console Tool</info>
 
 <comment>Usage:</comment>
-  UNKNOWN [options] command [arguments]
+  [options] command [arguments]
 
 <comment>Options:</comment>
   <info>--help</info>      <info>-h</info>  Display this help message.

+ 1 - 1
tests/fixtures/Symfony/Components/Console/application_renderexception2.txt

@@ -6,6 +6,6 @@
                                       
 
 
-UNKNOWN list [--xml] [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-c|--color] [-n|--no-interaction] command [namespace]
+list [--xml] [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-c|--color] [-n|--no-interaction] command [namespace]
 
 

+ 1 - 1
tests/fixtures/Symfony/Components/Console/application_run1.txt

@@ -1,7 +1,7 @@
 Console Tool
 
 Usage:
-  UNKNOWN [options] command [arguments]
+  [options] command [arguments]
 
 Options:
   --help      -h  Display this help message.

+ 1 - 1
tests/fixtures/Symfony/Components/Console/application_run2.txt

@@ -1,5 +1,5 @@
 Usage:
- UNKNOWN help [--xml] [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-c|--color] [-n|--no-interaction] command [command_name]
+ help [--xml] [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-c|--color] [-n|--no-interaction] command [command_name]
 
 Aliases: ?
 Arguments:

+ 1 - 1
tests/fixtures/Symfony/Components/Console/application_run3.txt

@@ -1,5 +1,5 @@
 Usage:
- UNKNOWN list [--xml] [namespace]
+ list [--xml] [namespace]
 
 Arguments:
  namespace  The namespace name

+ 1 - 1
tests/fixtures/Symfony/Components/Console/command_astext.txt

@@ -1,5 +1,5 @@
 <comment>Usage:</comment>
- UNKNOWN namespace:name [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-c|--color] [-n|--no-interaction] command
+ namespace:name [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-c|--color] [-n|--no-interaction] command
 
 <comment>Aliases:</comment> <info>name</info>
 <comment>Arguments:</comment>

+ 1 - 1
tests/fixtures/Symfony/Components/Console/command_asxml.txt

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <command id="namespace:name" namespace="namespace" name="name">
-  <usage> namespace:name [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-c|--color] [-n|--no-interaction] command</usage>
+  <usage>namespace:name [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-c|--color] [-n|--no-interaction] command</usage>
   <description>description</description>
   <help>help</help>
   <aliases>

+ 1 - 1
tests/unit/Symfony/Components/Console/Command/CommandTest.php

@@ -132,7 +132,7 @@ $t->is($command->getAliases(), array('name1'), '->setAliases() sets the aliases'
 
 // ->getSynopsis()
 $t->diag('->getSynopsis()');
-$t->is($command->getSynopsis(), '%s foobar:bar [--foo] [foo]', '->getSynopsis() returns the synopsis');
+$t->is($command->getSynopsis(), 'foobar:bar [--foo] [foo]', '->getSynopsis() returns the synopsis');
 
 // ->mergeApplicationDefinition()
 $t->diag('->mergeApplicationDefinition()');