CliInstaller.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears 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. #pragma once
  16. #include <string>
  17. #include "InstallCommandLine.h"
  18. /**
  19. * The installer without its window: it installs, or verifies an installation, from the command line.
  20. *
  21. * It does the same steps as the installer window (see InstallSteps), and writes the same installer.log. Where the
  22. * window asks, it stops, unless the user said to continue with --yes.
  23. */
  24. namespace CliInstaller{
  25. /**
  26. * Exit status when everything went well.
  27. */
  28. const int EXIT_OK = 0;
  29. /**
  30. * Exit status when the installation or the verification failed.
  31. */
  32. const int EXIT_FAILED = 1;
  33. /**
  34. * Exit status when the command line is wrong.
  35. */
  36. const int EXIT_USAGE = 2;
  37. /**
  38. * Exit status when the installation finished with errors in its log, with --strict.
  39. */
  40. const int EXIT_ERRORS = 3;
  41. /**
  42. * Exit status when the installation is interrupted (Ctrl+C), as usual: 128 plus the number of SIGINT.
  43. */
  44. const int EXIT_INTERRUPTED = 130;
  45. /**
  46. * Does what the command line asks.
  47. *
  48. * A QCoreApplication must exist. The mode of the arguments must not be GUI.
  49. *
  50. * @param[in] arguments The parsed command line.
  51. * @param[in] program Name of the program, for the usage text.
  52. * @return The exit status.
  53. */
  54. int Run(const InstallCommandLine::Arguments& arguments, const std::string& program);
  55. }