File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,17 @@ $ mkdir build && cl /D "NDEBUG" /O2 /Fe"build/lzw.exe" lzw.cpp
3939## Usage
4040
4141``` bash
42+ # Get Help Message
43+ $ lzw --help
44+ ' ' '
45+ Usage:
46+
4247# Compression
43- $ lzw compress -o < lzw filename > < a list of files >
48+ $ lzw compress [-o|--output <ARCHIVE>] <FILES>...
4449
4550# Decompression
46- $ lzw decompress < lzw filename>
51+ $ lzw decompress <ARCHIVE>
52+ ' ' '
4753```
4854
4955## Development
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ int cli_decompress(int argc, char** argv);
1414
1515int
1616cli (int argc, char ** argv) {
17- if (argc <= 2 ) {
17+ if (argc <= 1 ) {
1818 cerr << " Too few arguments." << endl;
1919 return EXIT_FAILURE;
2020 }
@@ -25,6 +25,15 @@ cli(int argc, char** argv) {
2525 return cli_compress (argc, argv);
2626 } else if (subcommand == " decompress" ) {
2727 return cli_decompress (argc, argv);
28+ } else if (subcommand == " -h" || subcommand == " --help" ) {
29+ cout << " Usage:" << endl
30+ << " " << endl
31+ << " # Compression" << endl
32+ << " $ lzw compress [-o|--output <ARCHIVE>] <FILES>..." << endl
33+ << " " << endl
34+ << " # Decompression" << endl
35+ << " $ lzw decompress <ARCHIVE> " << endl
36+ << endl;
2837 } else {
2938 cerr << " Invalid arguments" << endl;
3039 return EXIT_FAILURE;
You can’t perform that action at this time.
0 commit comments