Skip to content

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
vadiminc committed Jan 30, 2024
1 parent 6781a83 commit da56b35
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions dist/tsc/src/commands/actions/KeySharesAction.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/tsc/src/commands/actions/KeySharesAction.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/commands/actions/KeySharesAction.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import path from 'path';

import { BaseAction } from './BaseAction';
import { SSVKeys } from '../../lib/SSVKeys';
import { KeySharesItem } from '../../lib/KeyShares/KeySharesItem';
Expand Down Expand Up @@ -74,16 +76,21 @@ export class KeySharesAction extends BaseAction {
private async validateKeystoreFiles(files: string[]): Promise<string[]> {
const validatedFiles = [];
let failedValidation = 0;
for (const file of files) {
for (const [index, file] of files.entries()) {
const isKeyStoreValid = await keystoreArgument.interactive.options.validate(file);
const isValidPassword = await keystorePasswordValidator.validatePassword(this.args.password, file);
let status = '✅';
if (isKeyStoreValid === true && isValidPassword === true) {
validatedFiles.push(file);
} else {
failedValidation++;
status = '❌';
}
process.stdout.write(`\r${validatedFiles.length}/${files.length} keystore files successfully validated. ${failedValidation} failed validation`);
const fileName = path.basename(file); // Extract the file name
process.stdout.write(`\r\n${index+ 1}/${files.length} ${status} ${fileName}`);
}
process.stdout.write(`\n\n${files.length - failedValidation} of ${files.length} keystore files successfully validated. ${failedValidation} failed validation`);

process.stdout.write('\n');
return validatedFiles;
}
Expand Down

0 comments on commit da56b35

Please sign in to comment.