MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / ProcessOptions

Function ProcessOptions

cli.cpp:844–1067  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

842}
843
844int ProcessOptions(int argc, char* argv[], Options* options, std::vector<RGBController *>& rgb_controllers)
845{
846 unsigned int ret_flags = 0;
847 int arg_index = 1;
848 std::vector<DeviceOptions> current_devices;
849
850 options->hasDevice = false;
851 options->profile_loaded = false;
852
853#ifdef _WIN32
854 int fake_argc;
855 wchar_t** argvw = CommandLineToArgvW(GetCommandLineW(), &fake_argc);
856#endif
857
858 while(arg_index < argc)
859 {
860 std::string option = argv[arg_index];
861 std::string argument = "";
862 filesystem::path arg_path;
863
864 /*---------------------------------------------------------*\
865 | Handle options that take an argument |
866 \*---------------------------------------------------------*/
867 if(arg_index + 1 < argc)
868 {
869 argument = argv[arg_index + 1];
870#ifdef _WIN32
871 arg_path = argvw[arg_index + 1];
872#else
873 arg_path = argument;
874#endif
875 }
876
877 /*---------------------------------------------------------*\
878 | -l / --list-devices (no arguments) |
879 \*---------------------------------------------------------*/
880 if(option == "--list-devices" || option == "-l")
881 {
882 OptionListDevices(rgb_controllers);
883 exit(0);
884 }
885
886 /*---------------------------------------------------------*\
887 | -d / --device |
888 \*---------------------------------------------------------*/
889 else if(option == "--device" || option == "-d")
890 {
891 while(!current_devices.empty())
892 {
893 options->devices.push_back(current_devices.back());
894 current_devices.pop_back();
895 }
896
897 if(!OptionDevice(&current_devices, argument, options, rgb_controllers))
898 {
899 return RET_FLAG_PRINT_HELP;
900 }
901

Callers 1

cli_post_detectionFunction · 0.85

Calls 14

OptionListDevicesFunction · 0.85
OptionDeviceFunction · 0.85
OptionZoneFunction · 0.85
OptionColorFunction · 0.85
OptionModeFunction · 0.85
OptionBrightnessFunction · 0.85
OptionSizeFunction · 0.85
OptionProfileFunction · 0.85
OptionSaveProfileFunction · 0.85
to_stringFunction · 0.85
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected