55use Composer \Factory ;
66use Composer \Command \BaseCommand ;
77use FancyGuy \Composer \SecurityCheck \Checker \DefaultChecker ;
8+ use FancyGuy \Composer \SecurityCheck \Checker \HttpCheckerInterface ;
89use FancyGuy \Composer \SecurityCheck \Checker \OfflineChecker ;
910use FancyGuy \Composer \SecurityCheck \Exception \ExceptionInterface ;
1011use FancyGuy \Composer \SecurityCheck \Formatter \JsonFormatter ;
@@ -23,10 +24,11 @@ protected function configure()
2324 $ this
2425 ->setName ('audit ' )
2526 ->setDefinition (array (
26- new InputOption ('audit-db ' , '' , InputOption::VALUE_REQUIRED , 'The path to the advisory database ' ),
27- new InputOption ('format ' , '' , InputOption::VALUE_REQUIRED , 'The output format ' , 'text ' ),
28- new InputOption ('endpoint ' , '' , InputOption::VALUE_REQUIRED , 'The security checker server URL ' ),
29- new InputOption ('timeout ' , '' , InputOption::VALUE_REQUIRED , 'The HTTP timeout in seconds ' ),
27+ new InputOption ('audit-db ' , '' , InputOption::VALUE_REQUIRED , 'Path to the advisory database ' ),
28+ new InputOption ('format ' , '' , InputOption::VALUE_REQUIRED , 'Output format ' , 'text ' ),
29+ new InputOption ('endpoint ' , '' , InputOption::VALUE_REQUIRED , 'Security checker server URL ' , HttpCheckerInterface::DEFAULT_ENDPOINT ),
30+ new InputOption ('timeout ' , '' , InputOption::VALUE_REQUIRED , 'HTTP timeout in seconds ' , HttpCheckerInterface::DEFAULT_TIMEOUT ),
31+ new InputOption ('file ' , '' , InputOption::VALUE_REQUIRED , 'Path to composer.lock file ' , './composer.lock ' ),
3032 ))
3133 ->setDescription ('Checks security issues in your project dependencies ' )
3234 ->setHelp (<<<EOF
@@ -55,7 +57,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
5557 }
5658 }
5759
58- $ composerFile = Factory::getComposerFile ();
60+ if (!$ composerFile = $ input ->getOption ('file ' )) {
61+ $ composerFile = Factory::getComposerFile ();
62+ }
5963
6064 try {
6165 $ vulnerabilities = $ checker ->check ($ composerFile );
0 commit comments