diff options
author | rafa_99 <raroma09@gmail.com> | 2021-09-05 00:12:39 +0100 |
---|---|---|
committer | rafa_99 <raroma09@gmail.com> | 2021-09-05 00:12:39 +0100 |
commit | 0150234f07c9999a405f53ab4666984e17d27e0e (patch) | |
tree | 6552e22bf6fb6e7e64c8abd35484e38800e3d030 /queryt.c | |
parent | ed9ad979be88a230eb873e8914a2425f84f09b06 (diff) |
Some refactoring
Diffstat (limited to 'queryt.c')
-rw-r--r-- | queryt.c | 28 |
1 files changed, 22 insertions, 6 deletions
@@ -7,7 +7,9 @@ #include "include/video.h" #include "libs/json.h" -void processOptions(int *options, char **args); +#define VERSION "1.0" + +void processOptions(int *options, char **args, int argc); int main(int argc, char **argv) { @@ -54,7 +56,7 @@ int main(int argc, char **argv) } } - processOptions(opts, args); + processOptions(opts, args, argc); for ( int i = 0; i < 3; i++ ) { @@ -65,7 +67,7 @@ int main(int argc, char **argv) return 0; } -void processOptions(int *options, char **args) +void processOptions(int *options, char **args, int argc) { if ( !options[1] && options[3] && !options[4] ) { @@ -123,15 +125,29 @@ void processOptions(int *options, char **args) } else { - if ( options[1] || (options[3] && options[4])) + if ( options[1] || (options[3] && options[4]) || argc == 1) { - puts("Help Message"); + printf("Usage: queryt -s [SEARCH]... [OPTIONS]...\n" + "Make youtube querys without authentication or API Key\n\n" + " -f, --format format the output query with with custom modifiers\n" + " a author;\n" + " d duration;\n" + " i video id;\n" + " t title;\n" + " R return;\n" + " T tab;\n" + " -h, --help display this help and exit\n" + " -m, --max defines the max number of displayed results\n" + " -s, --search search content on youtube\n" + " -v, --version output version information and exit\n\n" + "Examples:\n" + " queryt -s \"Never Gonna Give You Up\" -m 5 -f iTaTdRt\n\n"); } else { if ( options[4] ) { - puts("Version Message"); + printf("queryt-%s\n", VERSION); } else { |