@@ -26,9 +26,9 @@ public class CyberFerretCLI {
2626
2727 private static void printUsage () {
2828 String errMsg = """
29- Usage: CyberFerretCLI $PATH_TO_REPOSITORY_TO_SCAN $PATH_TO_FILE_WITH_LIST_OF_FILES(optional)"
30- Also, note that '{}' System Environment variable must be set
31- """ ;
29+ Usage: CyberFerretCLI $PATH_TO_REPOSITORY_TO_SCAN $PATH_TO_FILE_WITH_LIST_OF_FILES(optional)"
30+ Also, note that '{}' System Environment variable must be set
31+ """ ;
3232 errMsg = ConsoleUtils .format (errMsg , SYS_ENV_VAR_PASSWORD );
3333 System .out .println (errMsg );
3434 }
@@ -46,9 +46,11 @@ public static void main(String[] args) {
4646 // Step5: Decrypt dictionary
4747 // Step6: Run check over the git-repository
4848
49+ String appVer = MiscUtils .loadApplicationVersion ();
50+ ConsoleUtils .info ("CyberFerretCLI version: " + appVer );
4951
5052 // Step1: Check required program arguments are set
51- if (args .length < 1 || args . length > 2 ) {
53+ if (args .length != 2 ) {
5254 ConsoleUtils .error ("Unexpected number of command line arguments" );
5355 printUsage ();
5456 terminateAppWithErrorCode ();
@@ -70,20 +72,25 @@ public static void main(String[] args) {
7072 }
7173
7274 List <Path > stagedFiles = new ArrayList <>();
73- if (args .length > 1 ) {
74- Path stagedFilesListPath = Path .of (args [1 ]);
75- if (!Files .isRegularFile (stagedFilesListPath )) {
76- ConsoleUtils .error ("Invalid path to file list {}" , stagedFilesListPath );
77- printUsage ();
78- terminateAppWithErrorCode ();
79- }
80- try {
81- stagedFiles = loadStagedFiles (rootPathToScan , stagedFilesListPath );
82- } catch (IOException ex ) {
83- ConsoleUtils .error ("Error while reading staged files list. " + ex .getMessage ());
84- terminateAppWithErrorCode ();
85- }
75+
76+ Path stagedFilesListPath = Path .of (args [1 ]);
77+ if (!Files .isRegularFile (stagedFilesListPath )) {
78+ ConsoleUtils .error ("Invalid path to file list {}" , stagedFilesListPath );
79+ printUsage ();
80+ terminateAppWithErrorCode ();
8681 }
82+ try {
83+ stagedFiles = loadStagedFiles (rootPathToScan , stagedFilesListPath );
84+ } catch (IOException ex ) {
85+ ConsoleUtils .error ("Error while reading staged files list. " + ex .getMessage ());
86+ terminateAppWithErrorCode ();
87+ }
88+
89+ if (stagedFiles .isEmpty ()) {
90+ ConsoleUtils .error ("No staged files found in the file {}" , stagedFilesListPath );
91+ terminateAppWithErrorCode ();
92+ }
93+
8794
8895 // Step3: Ensure actual dictionary is downloaded
8996 RunnableCheckOnlineDictionary dictionaryDownloader = new RunnableCheckOnlineDictionary (true );
@@ -133,7 +140,7 @@ public static void main(String[] args) {
133140 }
134141 }
135142
136- ConsoleUtils .debug ("Scan is completed. Errors are " + (runnableScanner .isAnySignatureFound () ? "found (-). Breaking commit!" : "NOT found (+ )" ));
143+ ConsoleUtils .info ("Scan is completed. Errors are " + (runnableScanner .isAnySignatureFound () ? "found :( Breaking commit!" : "not found : )" ));
137144
138145 if (runnableScanner .isAnySignatureFound ()) {
139146 terminateAppWithErrorCode ();
0 commit comments