]> Kevux Git Server - fll/commitdiff
Bugfix: iki_write needs to handle the error cases where -o/--object and -c/--content...
authorKevin Day <thekevinday@gmail.com>
Sat, 19 Sep 2020 04:24:27 +0000 (23:24 -0500)
committerKevin Day <thekevinday@gmail.com>
Sat, 19 Sep 2020 04:24:27 +0000 (23:24 -0500)
The -o/--object and -c/--content parameters both require an additional parameter.
If that additional parameter is missing, then error out.

level_3/iki_write/c/iki_write.c

index f9ee15c8bb1175ea695b44cf3c85276c086cacf3..0dc541f81f2bcf43c3437323fea9b20d6eb54fa6 100644 (file)
@@ -144,6 +144,26 @@ extern "C" {
       }
     }
 
+    if (F_status_is_fine(status) && data->parameters[iki_write_parameter_object].result == f_console_result_found) {
+      if (data->verbosity != iki_write_verbosity_quiet) {
+        fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: The parameter '");
+        fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, iki_write_long_object);
+        fl_color_print_line(f_type_error, data->context.error, data->context.reset, "' was specified, but no value was given.");
+      }
+
+      status = F_status_set_error(F_parameter);
+    }
+
+    if (F_status_is_fine(status) && data->parameters[iki_write_parameter_content].result == f_console_result_found) {
+      if (data->verbosity != iki_write_verbosity_quiet) {
+        fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: The parameter '");
+        fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, iki_write_long_content);
+        fl_color_print_line(f_type_error, data->context.error, data->context.reset, "' was specified, but no value was given.");
+      }
+
+      status = F_status_set_error(F_parameter);
+    }
+
     if (F_status_is_fine(status) && !data->process_pipe) {
       if (data->parameters[iki_write_parameter_object].result != f_console_result_additional && data->parameters[iki_write_parameter_content].result != f_console_result_additional) {
         if (data->verbosity != iki_write_verbosity_quiet) {