aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-06-28 00:11:16 +0200
committerdec05eba <dec05eba@protonmail.com>2020-06-28 00:11:16 +0200
commit1ed1159468602c649f170713eaea08f47f69c23f (patch)
treee73bd3e8a42d24f194107b461384e31013e850d8 /src/QuickMedia.cpp
parent52d2bcde946b4cc05932db347bce44d2fd518865 (diff)
Output error when wrong flag is passed to quickmedia
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index aba9485..881f2d6 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -112,7 +112,7 @@ namespace QuickMedia {
fprintf(stderr, "EXAMPLES:\n");
fprintf(stderr, "QuickMedia manganelo\n");
fprintf(stderr, "QuickMedia youtube --tor\n");
- fprintf(stderr, "echo \"hello\nworld\" | QuickMedia dmenu\n");
+ fprintf(stderr, "echo \"hello\\nworld\" | QuickMedia dmenu\n");
}
static bool is_program_executable_by_name(const char *name) {
@@ -165,6 +165,10 @@ namespace QuickMedia {
plugin_logo_path = resources_root + "images/4chan_logo.png";
} else if(strcmp(argv[i], "dmenu") == 0) {
current_plugin = new Dmenu();
+ } else {
+ fprintf(stderr, "Invalid plugin %s\n", argv[i]);
+ usage();
+ return -1;
}
}
@@ -172,14 +176,13 @@ namespace QuickMedia {
use_tor = true;
} else if(strcmp(argv[i], "--use-system-mpv-config") == 0) {
use_system_mpv_config = true;
+ } else if(argv[i][0] == '-') {
+ fprintf(stderr, "Invalid option %s\n", argv[i]);
+ usage();
+ return -1;
}
}
- if(!current_plugin) {
- usage();
- return -1;
- }
-
if(use_tor && !is_program_executable_by_name("torsocks")) {
fprintf(stderr, "torsocks needs to be installed (and accessible from PATH environment variable) when using the --tor option\n");
return -2;