timeless.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * This file is the main code of Timeless
  3. * Copyright (C) <2019> <alkeon> [alkeon@autistici.org]
  4. *
  5. * Texdi is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Texdi is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with timeless. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. #include <iostream>
  20. #include <string>
  21. #include <fstream>
  22. #include <sstream>
  23. #include "parser.h"
  24. #include "datalite.h"
  25. using namespace std;
  26. int main(int argc, char *argv[]){
  27. cout << "TIMELESS" << endl;
  28. if(argc > 1){
  29. string load(argv[1]);
  30. if(load == "--new")
  31. datalite d("news");
  32. else if(load == "--help"){
  33. cout << "Help menu" << endl;
  34. cout << "tm --new -- Start news database" << endl;
  35. cout << "tm --get-news -- Download and read news" << endl;
  36. cout << "tm --clean-news -- Delete not marked news" << endl;
  37. cout << "tm --help -- Help" << endl;
  38. }else if(load == "--get-news"){
  39. parser p;
  40. p.get_news();
  41. }else if(load == "--clean-news"){
  42. datalite d;
  43. d.set_file("news");
  44. d.delete_news();
  45. }
  46. }else{
  47. datalite d;
  48. d.set_file("news");
  49. d.show_news();
  50. }
  51. }