-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
32 lines (25 loc) · 800 Bytes
/
main.cpp
File metadata and controls
32 lines (25 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "archiver.h"
int main(int argc, char* argv[]) {
if (argc <= 1) {
std::cout << "Use \"-h\" to get help\n";
return 0;
}
if (argv[1] == std::string("-h")) {
std::cout << "Use \"-c archive_name file1 [file2 ...]\" to archive files file1, file2, ... "
"and save result to "
"file named archive_name\n";
std::cout
<< "Use \"-d archive_name\" to dearchive files from archive_name to current directory";
return 0;
}
Archiver archiver;
if (argv[1] == std::string("-c")) {
archiver.Compress(argc, argv);
return 0;
}
if (argv[1] == std::string("-d")) {
archiver.Decompress(argv[2]);
return 0;
}
std::cout << "Unknown flags\n";
}