add print file size
This commit is contained in:
parent
31e9935511
commit
1cbf1628a3
@ -21,6 +21,7 @@ enum class Arg
|
||||
Username, // update username
|
||||
Name, // update label name
|
||||
File, // select save file
|
||||
Size // show size of file
|
||||
};
|
||||
|
||||
Arg get_args(int argc, char **argv, char **label);
|
||||
@ -45,4 +46,6 @@ void arg_show(Buffer &decrypted_buffer, const char *label);
|
||||
|
||||
void arg_file(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const char *label, Cryptography &crypto, std::string &save_location_path);
|
||||
|
||||
void arg_size(Buffer &encrypted_buffer);
|
||||
|
||||
#endif
|
4
main.cpp
4
main.cpp
@ -146,6 +146,10 @@ int main(int argc, char **argv)
|
||||
arg_file(decrypted_buffer, encrypted_buffer, label, crypto, save_location_path.value());
|
||||
break;
|
||||
|
||||
case Arg::Size:
|
||||
arg_size(encrypted_buffer);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ void print_args()
|
||||
printf(" -l list all labels\n");
|
||||
printf(" -p print all passwords\n");
|
||||
printf(" -c change master password\n");
|
||||
printf(" -z print size of file\n");
|
||||
printf(" -f <folder path> select save folder\n");
|
||||
}
|
||||
|
||||
@ -58,6 +59,8 @@ Arg get_args(int argc, char **argv, char **label)
|
||||
return Arg::Print_all_p;
|
||||
case 'c':
|
||||
return Arg::Change;
|
||||
case 'z':
|
||||
return Arg::Size;
|
||||
}
|
||||
|
||||
if (argc != 3)
|
||||
@ -347,4 +350,9 @@ void arg_file(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const char *la
|
||||
|
||||
crypto.encrypt(&decrypted_buffer, &encrypted_buffer);
|
||||
encrypted_buffer.save_to_file(save.string());
|
||||
}
|
||||
|
||||
void arg_size(Buffer &encrypted_buffer)
|
||||
{
|
||||
printf("File size is: %ldB\n", encrypted_buffer.taken);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user