3
3
namespace Comcast \PhpLegalLicenses \Console ;
4
4
5
5
use Symfony \Component \Console \Input \InputInterface ;
6
+ use Symfony \Component \Console \Input \InputOption ;
6
7
use Symfony \Component \Console \Output \OutputInterface ;
7
8
8
9
class GenerateCommand extends DependencyLicenseCommand
9
10
{
11
+ /**
12
+ * @var bool
13
+ */
14
+ private $ hideVersion = false ;
15
+
10
16
/**
11
17
* Configure the command options.
12
18
*
@@ -16,7 +22,8 @@ protected function configure()
16
22
{
17
23
$ this
18
24
->setName ('generate ' )
19
- ->setDescription ('Generate Licenses file from project dependencies. ' );
25
+ ->setDescription ('Generate Licenses file from project dependencies. ' )
26
+ ->addOption ('hide-version ' , 'hv ' , InputOption::VALUE_NONE , 'Hide dependency version ' );
20
27
}
21
28
22
29
/**
@@ -29,6 +36,7 @@ protected function configure()
29
36
*/
30
37
protected function execute (InputInterface $ input , OutputInterface $ output )
31
38
{
39
+ $ this ->hideVersion = $ input ->getOption ('hide-version ' );
32
40
$ dependencies = $ this ->getDependencyList ();
33
41
34
42
$ output ->writeln ('<info>Generating Licenses file...</info> ' );
@@ -119,14 +127,14 @@ protected function getFullLicenseText($name)
119
127
* @param string $version
120
128
* @param string $homepage
121
129
* @param string $sha
122
- * @param string $licenceNames
130
+ * @param string $licenseNames
123
131
* @param string $license
124
132
*
125
133
* @return string
126
134
*/
127
135
protected function generateDependencyText ($ name , $ description , $ version , $ homepage , $ sha , $ licenseNames , $ license )
128
136
{
129
- return "### $ name ( Version $ version | $ sha)
137
+ return "### $ name " .( $ this -> hideVersion ? '' : " ( Version $ version | $ sha) " ). "
130
138
$ description
131
139
Homepage: $ homepage
132
140
Licenses Used: $ licenseNames
0 commit comments