juk3n/fluffypublic Fork
⑂ 48926f6
Commits
⬇ Clone ▾
git clone https://git.rickub.com/juk3n/fluffy.git
git clone ssh://git@rickub.com/juk3n/fluffy.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

added printing default messages

juk3n committed 2024-07-08T12:27:18+02:00 Browse files
48926f6 parent: 33742aa
modified app/include/output.hpp +3 -0
@@ -15,4 +15,7 @@ public:
1515 if (debugRun)
1616 std::cerr << message << std::endl;
1717 }
18+ auto printMessage(std::string message) -> void {
19+ std::cout << message << std::endl;
20+ }
1821 };
\ No newline at end of file
@@ -15,4 +15,7 @@ public:
15 if (debugRun)15 if (debugRun)
16 std::cerr << message << std::endl;16 std::cerr << message << std::endl;
17 }17 }
18+ auto printMessage(std::string message) -> void {
19+ std::cout << message << std::endl;
20+ }
18 };21 };
\ No newline at end of file\ No newline at end of file
modified app/src/main.cpp +11 -11
@@ -18,14 +18,14 @@
1818
1919 #include <game.hpp>
2020 #include <database.hpp>
21+#include <output.hpp>
2122
2223 using namespace ftxui;
2324
24-
25+Output output{};
2526 std::string version{ "v0.1.2" };
2627 std::vector<Game> games;
2728
28-bool debugRun = false;
2929
3030 auto addGame(Database& database, std::string name, std::string path) -> void {
3131 std::string command =
@@ -81,17 +81,17 @@ auto handleCommand(const std::string& command, const std::vector<std::string>& a
8181 runGame(gameName);
8282 }
8383 else if (command == "--version") {
84- std::cout << "fluffy " + version << std::endl;
84+ output.printMessage("fluffy " + version);
8585 }
8686 else if (command == "--help") {
87- std::cout << "fluffy commands:" << std::endl;
88- std::cout << " play <game_name> Runs a game" << std::endl;
89- std::cout << " add <game_name> <game_path> Add a game library" << std::endl;
90- std::cout << " show Show all games added to library" << std::endl;
91- std::cout << " rm <game_name> Remove game from a library" << std::endl;
87+ output.printMessage("fluffy commands:\n \
88+ play <game_name> Runs a game\n \
89+ add <game_name> <game_path> Add a game library\n \
90+ show Show all games added to library\n \
91+ rm <game_name> Remove game from a library");
9292 }
9393 else {
94- std::cout << "fluffy: '" << command << "' is not a fluffy command. See 'fluffy --help'" << std::endl;
94+ output.printMessage("fluffy: '" + command + "' is not a fluffy command. See 'fluffy --help'");
9595 }
9696 }
9797
@@ -148,10 +148,10 @@ auto runConsoleApp() -> void {
148148 auto handleFlags(std::vector<std::string> flags) -> void {
149149 for (const auto& flag : flags) {
150150 if (flag == "-test") {
151- std::cout << "hello!" << std::endl;
151+ output.printMessage("hello!");
152152 }
153153 else {
154- std::cout << "unkown option: '" << flag << "'" << std::endl;
154+ output.printMessage("unkown option: '" + flag + "'");
155155 }
156156 }
157157 }
@@ -18,14 +18,14 @@
18 18
19 #include <game.hpp>19 #include <game.hpp>
20 #include <database.hpp>20 #include <database.hpp>
21+#include <output.hpp>
21 22
22 using namespace ftxui;23 using namespace ftxui;
23 24
24-25+Output output{};
25 std::string version{ "v0.1.2" };26 std::string version{ "v0.1.2" };
26 std::vector<Game> games;27 std::vector<Game> games;
27 28
28-bool debugRun = false;
29 29
30 auto addGame(Database& database, std::string name, std::string path) -> void {30 auto addGame(Database& database, std::string name, std::string path) -> void {
31 std::string command =31 std::string command =
@@ -81,17 +81,17 @@ auto handleCommand(const std::string& command, const std::vector<std::string>& a
81 runGame(gameName);81 runGame(gameName);
82 }82 }
83 else if (command == "--version") {83 else if (command == "--version") {
84- std::cout << "fluffy " + version << std::endl;84+ output.printMessage("fluffy " + version);
85 }85 }
86 else if (command == "--help") {86 else if (command == "--help") {
87- std::cout << "fluffy commands:" << std::endl;87+ output.printMessage("fluffy commands:\n \
88- std::cout << " play <game_name> Runs a game" << std::endl;88+ play <game_name> Runs a game\n \
89- std::cout << " add <game_name> <game_path> Add a game library" << std::endl;89+ add <game_name> <game_path> Add a game library\n \
90- std::cout << " show Show all games added to library" << std::endl;90+ show Show all games added to library\n \
91- std::cout << " rm <game_name> Remove game from a library" << std::endl;91+ rm <game_name> Remove game from a library");
92 }92 }
93 else {93 else {
94- std::cout << "fluffy: '" << command << "' is not a fluffy command. See 'fluffy --help'" << std::endl;94+ output.printMessage("fluffy: '" + command + "' is not a fluffy command. See 'fluffy --help'");
95 }95 }
96 }96 }
97 97
@@ -148,10 +148,10 @@ auto runConsoleApp() -> void {
148 auto handleFlags(std::vector<std::string> flags) -> void {148 auto handleFlags(std::vector<std::string> flags) -> void {
149 for (const auto& flag : flags) {149 for (const auto& flag : flags) {
150 if (flag == "-test") {150 if (flag == "-test") {
151- std::cout << "hello!" << std::endl;151+ output.printMessage("hello!");
152 }152 }
153 else {153 else {
154- std::cout << "unkown option: '" << flag << "'" << std::endl;154+ output.printMessage("unkown option: '" + flag + "'");
155 }155 }
156 }156 }
157 }157 }