File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 3333#include < cstdlib>
3434#include < future>
3535#include < ios>
36+ #include < unistd.h>
3637
3738int main (int argc, char ** argv)
3839{
@@ -135,7 +136,36 @@ int main(int argc, char** argv)
135136 interfaces.emplace_back (std::make_unique<StatsDemo>());
136137 interfaces.emplace_back (std::make_unique<TextToSpeechDemo>());
137138
138- if (appConfig.autoRun )
139+ if (!isatty (fileno (stdin)))
140+ {
141+ appConfig.autoRun = true ;
142+ std::string line;
143+ while (std::getline (std::cin, line))
144+ {
145+ bool found = false ;
146+ for (const auto & interface : interfaces)
147+ {
148+ for (const auto & method : interface->methods ())
149+ {
150+ if (method == line)
151+ {
152+ interface->runOption (method);
153+ found = true ;
154+ break ;
155+ }
156+ }
157+ if (found)
158+ {
159+ break ;
160+ }
161+ }
162+ if (!found)
163+ {
164+ std::cout << " Method not found: " << line << std::endl;
165+ }
166+ }
167+ }
168+ else if (appConfig.autoRun )
139169 {
140170 for (auto & interface : interfaces)
141171 {
Original file line number Diff line number Diff line change 1+ Accessibility.highContrastUI
2+ Device.chipsetId
3+ TextToSpeech.speak
4+ TextToSpeech.listVoices
5+ TextToSpeech.pause
You can’t perform that action at this time.
0 commit comments