comfortable-swipe/comfortable-swipe.cpp
Rico Tiongson 204a422f2d
Add status service command (#54)
* Use std::unique_ptr for stop service

* Use std::unique_ptr for stop service

* Add status command

* Prefer to use std::array to avoid memory leaking in buffer

* Perform xdo key sequence before output message

* Fix missing swipe_gesture header in regex implementation
2019-02-13 09:27:41 +08:00

68 lines
1.8 KiB
C++

/*
Comfortable Swipe
by Rico Tiongson
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ios> // std::ios
#include <iostream> // std::cin, std::cout, std::cerr
#include <string> // std::string
#include "lib/comfortable_swipe"
/* MAIN DRIVER FUNCTION */
int main(int argc, char** args)
{
// improve buffering by decoupling loggers from stdio
std::ios::sync_with_stdio(false);
std::cin.tie(0);
std::cout.tie(0);
std::cerr.tie(0);
if (argc > 1)
{
std::string arg = args[1];
// select based on argument
if (arg == "start")
comfortable_swipe::service::start();
else if (arg == "stop")
comfortable_swipe::service::stop();
else if (arg == "restart")
comfortable_swipe::service::restart();
else if (arg == "buffer")
comfortable_swipe::service::buffer();
else if (arg == "autostart")
comfortable_swipe::service::autostart();
else if (arg == "debug")
comfortable_swipe::service::debug();
else if (arg == "status")
comfortable_swipe::service::status();
else /* if (arg == "help") */
comfortable_swipe::service::help();
}
else
comfortable_swipe::service::help();
return 0;
}