@@ -568,6 +568,8 @@ bool OptionDevice(std::vector<DeviceOptions>* current_devices, std::string argum
568568 {
569569 int current_device = std::stoi (argument);
570570
571+ LOG_TRACE (" [CLI] using device number %d for argument %s" , current_device, argument.c_str ());
572+
571573 if ((current_device >= static_cast <int >(rgb_controllers.size ())) || (current_device < 0 ))
572574 {
573575 throw nullptr ;
@@ -589,6 +591,11 @@ bool OptionDevice(std::vector<DeviceOptions>* current_devices, std::string argum
589591 {
590592 if (argument.length () > 1 )
591593 {
594+ std::string argument_lower = argument;
595+ std::transform (argument_lower.begin (), argument_lower.end (), argument_lower.begin (), ::tolower);
596+
597+ LOG_TRACE (" [CLI] Searching for %s" , argument_lower.c_str ());
598+
592599 for (unsigned int i = 0 ; i < rgb_controllers.size (); i++)
593600 {
594601 /* ---------------------------------------------------------*\
@@ -597,9 +604,9 @@ bool OptionDevice(std::vector<DeviceOptions>* current_devices, std::string argum
597604 \*---------------------------------------------------------*/
598605 std::string name = rgb_controllers[i]->name ;
599606 std::transform (name.begin (), name.end (), name.begin (), ::tolower);
600- std::transform (argument. begin (), argument. end (), argument. begin (), ::tolower );
607+ LOG_TRACE ( " [CLI] Comparing to %s " , name. c_str () );
601608
602- if (name.find (argument ) != std::string::npos)
609+ if (name.find (argument_lower ) != std::string::npos)
603610 {
604611 found = true ;
605612
@@ -617,11 +624,16 @@ bool OptionDevice(std::vector<DeviceOptions>* current_devices, std::string argum
617624 }
618625 else
619626 {
620- std::cout << " Error: Invalid device ID: " + argument << std::endl;
627+ std::cout << " Error: Empty device ID" << std::endl;
621628 return false ;
622629 }
623630 }
624631
632+ if (!found)
633+ {
634+ std::cout << " Error: Cannot find device \" " << argument << " \" " << std::endl;
635+ }
636+
625637 return found;
626638}
627639
@@ -729,6 +741,10 @@ bool OptionMode(std::vector<DeviceOptions>* current_devices, std::string argumen
729741 }
730742 }
731743
744+ if (!found)
745+ {
746+ std::cout << " Error: No devices for mode \" " << argument << " \" " << std::endl;
747+ }
732748 return found;
733749}
734750
@@ -765,6 +781,10 @@ bool OptionSpeed(std::vector<DeviceOptions>* current_devices, std::string argume
765781 }
766782 }
767783
784+ if (!found)
785+ {
786+ std::cout << " Error: No devices for speed \" " << argument << " \" " << std::endl;
787+ }
768788 return found;
769789}
770790
@@ -801,6 +821,10 @@ bool OptionBrightness(std::vector<DeviceOptions>* current_devices, std::string a
801821 }
802822 }
803823
824+ if (!found)
825+ {
826+ std::cout << " Error: No devices for brightness \" " << argument << " \" " << std::endl;
827+ }
804828 return found;
805829}
806830
@@ -1731,7 +1755,7 @@ unsigned int cli_post_detection()
17311755 break ;
17321756
17331757 case RET_FLAG_PRINT_HELP:
1734- OptionHelp () ;
1758+ std::cout << " Run `OpenRGB --help` for syntax " << std::endl ;
17351759 exit (-1 );
17361760 break ;
17371761
0 commit comments