juk3n/fluffypublic Fork
⑂ e7d18a4
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.

34 remove UI (#35)Unverified

* removed ftxui

* run help command when nothing provided

---------

Co-authored-by: Adrian Duraj <adrian.duraj@onmail.com>
Adrian Duraj committed 2025-02-22T11:59:59+01:00 Browse files
e7d18a4 parent: 89d42b6
modified app/CMakeLists.txt +0 -19
@@ -5,37 +5,21 @@ project(fluffy LANGUAGES CXX VERSION 1.0.0)
55
66 include(FetchContent)
77
8-set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
9-FetchContent_Declare(ftxui
10- GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
11- GIT_TAG v5.0.0
12-)
13-FetchContent_MakeAvailable(ftxui)
14-if(NOT ftxui_POPULATED)
15- FetchContent_Populate(ftxui)
16- add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
17-endif()
18-
19-
208 FetchContent_Declare(googletest
219 GIT_REPOSITORY https://github.com/google/googletest
2210 GIT_TAG v1.14.0
2311 )
2412 FetchContent_MakeAvailable(googletest)
2513
26-
2714 #find_program(CLANG_TIDY NAMES "clang-tidy" REQUIRED)
2815 #set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "-checks=-*,modernize-*")
2916
30-
3117 find_package(SQLite3 REQUIRED)
3218
3319 include_directories(${CMAKE_SOURCE_DIR}/include)
3420 enable_testing()
3521 add_executable(fluffy src/main.cpp src/fluffyApplication.cpp)
3622
37-
38-
3923 add_executable(
4024 tests
4125 tests/gameTest.cpp
@@ -46,9 +30,6 @@ target_link_libraries(
4630 )
4731
4832 target_link_libraries(fluffy
49- PRIVATE ftxui::screen
50- PRIVATE ftxui::dom
51- PRIVATE ftxui::component
5233 PRIVATE SQLite::SQLite3
5334 )
5435 #set_target_properties(fluffy PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
@@ -5,37 +5,21 @@ project(fluffy LANGUAGES CXX VERSION 1.0.0)
5 5
6 include(FetchContent)6 include(FetchContent)
7 7
8-set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
9-FetchContent_Declare(ftxui
10- GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
11- GIT_TAG v5.0.0
12-)
13-FetchContent_MakeAvailable(ftxui)
14-if(NOT ftxui_POPULATED)
15- FetchContent_Populate(ftxui)
16- add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
17-endif()
18-
19-
20 FetchContent_Declare(googletest8 FetchContent_Declare(googletest
21 GIT_REPOSITORY https://github.com/google/googletest9 GIT_REPOSITORY https://github.com/google/googletest
22 GIT_TAG v1.14.010 GIT_TAG v1.14.0
23 )11 )
24 FetchContent_MakeAvailable(googletest)12 FetchContent_MakeAvailable(googletest)
25 13
26-
27 #find_program(CLANG_TIDY NAMES "clang-tidy" REQUIRED)14 #find_program(CLANG_TIDY NAMES "clang-tidy" REQUIRED)
28 #set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "-checks=-*,modernize-*")15 #set(CLANG_TIDY_COMMAND "${CLANG_TIDY}" "-checks=-*,modernize-*")
29 16
30-
31 find_package(SQLite3 REQUIRED)17 find_package(SQLite3 REQUIRED)
32 18
33 include_directories(${CMAKE_SOURCE_DIR}/include)19 include_directories(${CMAKE_SOURCE_DIR}/include)
34 enable_testing()20 enable_testing()
35 add_executable(fluffy src/main.cpp src/fluffyApplication.cpp)21 add_executable(fluffy src/main.cpp src/fluffyApplication.cpp)
36 22
37-
38-
39 add_executable(23 add_executable(
40 tests24 tests
41 tests/gameTest.cpp25 tests/gameTest.cpp
@@ -46,9 +30,6 @@ target_link_libraries(
46 )30 )
47 31
48 target_link_libraries(fluffy32 target_link_libraries(fluffy
49- PRIVATE ftxui::screen
50- PRIVATE ftxui::dom
51- PRIVATE ftxui::component
52 PRIVATE SQLite::SQLite333 PRIVATE SQLite::SQLite3
53 )34 )
54 #set_target_properties(fluffy PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")35 #set_target_properties(fluffy PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
modified app/include/fluffyApplication.hpp +0 -15
@@ -1,14 +1,5 @@
11 #pragma once
22
3-
4-#include <ftxui/component/component.hpp>
5-#include <ftxui/component/component_base.hpp>
6-#include <ftxui/component/component_options.hpp>
7-#include <ftxui/component/screen_interactive.hpp>
8-#include <ftxui/dom/elements.hpp>
9-#include <ftxui/screen/screen.hpp>
10-#include <ftxui/screen/string.hpp>
11-
123 #include <cstdlib>
134 #include <filesystem>
145 #include <iostream>
@@ -24,8 +15,6 @@
2415 #include <database.hpp>
2516 #include <output.hpp>
2617
27-using namespace ftxui;
28-
2918 class FluffyApplication {
3019 public:
3120 FluffyApplication(int argc, char const *argv[]);
@@ -43,10 +32,6 @@ private:
4332
4433 auto handleCommand(const std::string& command, const std::vector<std::string>& arguments, Database& database) -> void;
4534
46- auto style() -> ButtonOption;
47-
48- auto runConsoleApp() -> void;
49-
5035 auto handleFlags(std::vector<std::string> flags) -> void;
5136
5237 auto getExecutablePath() -> std::filesystem::path;
@@ -1,14 +1,5 @@
1 #pragma once1 #pragma once
2 2
3-
4-#include <ftxui/component/component.hpp>
5-#include <ftxui/component/component_base.hpp>
6-#include <ftxui/component/component_options.hpp>
7-#include <ftxui/component/screen_interactive.hpp>
8-#include <ftxui/dom/elements.hpp>
9-#include <ftxui/screen/screen.hpp>
10-#include <ftxui/screen/string.hpp>
11-
12 #include <cstdlib>3 #include <cstdlib>
13 #include <filesystem>4 #include <filesystem>
14 #include <iostream>5 #include <iostream>
@@ -24,8 +15,6 @@
24 #include <database.hpp>15 #include <database.hpp>
25 #include <output.hpp>16 #include <output.hpp>
26 17
27-using namespace ftxui;
28-
29 class FluffyApplication {18 class FluffyApplication {
30 public:19 public:
31 FluffyApplication(int argc, char const *argv[]);20 FluffyApplication(int argc, char const *argv[]);
@@ -43,10 +32,6 @@ private:
43 32
44 auto handleCommand(const std::string& command, const std::vector<std::string>& arguments, Database& database) -> void;33 auto handleCommand(const std::string& command, const std::vector<std::string>& arguments, Database& database) -> void;
45 34
46- auto style() -> ButtonOption;
47-
48- auto runConsoleApp() -> void;
49-
50 auto handleFlags(std::vector<std::string> flags) -> void;35 auto handleFlags(std::vector<std::string> flags) -> void;
51 36
52 auto getExecutablePath() -> std::filesystem::path;37 auto getExecutablePath() -> std::filesystem::path;
modified app/src/fluffyApplication.cpp +1 -50
@@ -70,55 +70,6 @@ auto FluffyApplication::handleCommand(const std::string& command, const std::vec
7070 }
7171 }
7272
73-auto FluffyApplication::style() -> ButtonOption {
74- auto option = ButtonOption::Border();
75- option.transform = [](const EntryState &s) {
76- auto element = text(s.label);
77- if (s.focused) {
78- element |= bold;
79- }
80- return element | size(HEIGHT, LESS_THAN, 10);
81- };
82- return option;
83-}
84-
85-auto FluffyApplication::runConsoleApp() -> void {
86- system("clear");
87-
88- std::vector<std::string> localGames = {};
89- for (auto &game : games) {
90- localGames.emplace_back(game.getName());
91- }
92- localGames.emplace_back("Exit");
93-
94- auto gamesContainer{Container::Vertical({})};
95- for (auto &game : games) {
96- gamesContainer->Add(Button(
97- game.getName(), [&] { runGame(game.getName()); }, style()));
98- }
99-
100- auto menu_screen = ScreenInteractive::TerminalOutput();
101-
102- auto quitButton = Button("Exit", menu_screen.ExitLoopClosure(), style());
103- gamesContainer->Add(quitButton);
104-
105- int menuOptionSelected{0};
106- auto appContainer =
107- Container::Tab({gamesContainer}, &menuOptionSelected);
108-
109- auto container = Container::Horizontal({
110- appContainer,
111- });
112- auto renderer = Renderer(container, [&] {
113- return vbox({
114- center(text("Fluffy " + version)),
115- appContainer->Render(),
116- }) |
117- border | size(WIDTH, LESS_THAN, 120);
118- });
119- menu_screen.Loop(renderer);
120-
121-}
12273
12374 auto FluffyApplication::handleFlags(std::vector<std::string> flags) -> void {
12475 for (const auto& flag : flags) {
@@ -176,6 +127,6 @@ FluffyApplication::FluffyApplication(int argc, char const *argv[]) {
176127 if (command != "") handleCommand(command, arguments, database);
177128 }
178129 else {
179- runConsoleApp();
130+ handleCommand("--help", {}, database);
180131 }
181132 }
@@ -70,55 +70,6 @@ auto FluffyApplication::handleCommand(const std::string& command, const std::vec
70 }70 }
71 }71 }
72 72
73-auto FluffyApplication::style() -> ButtonOption {
74- auto option = ButtonOption::Border();
75- option.transform = [](const EntryState &s) {
76- auto element = text(s.label);
77- if (s.focused) {
78- element |= bold;
79- }
80- return element | size(HEIGHT, LESS_THAN, 10);
81- };
82- return option;
83-}
84-
85-auto FluffyApplication::runConsoleApp() -> void {
86- system("clear");
87-
88- std::vector<std::string> localGames = {};
89- for (auto &game : games) {
90- localGames.emplace_back(game.getName());
91- }
92- localGames.emplace_back("Exit");
93-
94- auto gamesContainer{Container::Vertical({})};
95- for (auto &game : games) {
96- gamesContainer->Add(Button(
97- game.getName(), [&] { runGame(game.getName()); }, style()));
98- }
99-
100- auto menu_screen = ScreenInteractive::TerminalOutput();
101-
102- auto quitButton = Button("Exit", menu_screen.ExitLoopClosure(), style());
103- gamesContainer->Add(quitButton);
104-
105- int menuOptionSelected{0};
106- auto appContainer =
107- Container::Tab({gamesContainer}, &menuOptionSelected);
108-
109- auto container = Container::Horizontal({
110- appContainer,
111- });
112- auto renderer = Renderer(container, [&] {
113- return vbox({
114- center(text("Fluffy " + version)),
115- appContainer->Render(),
116- }) |
117- border | size(WIDTH, LESS_THAN, 120);
118- });
119- menu_screen.Loop(renderer);
120-
121-}
122 73
123 auto FluffyApplication::handleFlags(std::vector<std::string> flags) -> void {74 auto FluffyApplication::handleFlags(std::vector<std::string> flags) -> void {
124 for (const auto& flag : flags) {75 for (const auto& flag : flags) {
@@ -176,6 +127,6 @@ FluffyApplication::FluffyApplication(int argc, char const *argv[]) {
176 if (command != "") handleCommand(command, arguments, database);127 if (command != "") handleCommand(command, arguments, database);
177 }128 }
178 else {129 else {
179- runConsoleApp();130+ handleCommand("--help", {}, database);
180 } 131 }
181 }132 }