Skip to content

Commit e37e6cb

Browse files
committed
feat: Added Task Manager CLI example
1 parent a116ac4 commit e37e6cb

15 files changed

Lines changed: 27158 additions & 14 deletions

File tree

.github/workflows/build.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,46 @@ jobs:
3737
uses: actions/cache@v4
3838
with:
3939
path: |
40-
examples/ImGui/build/
41-
key: ${{ runner.os }}-build-${{ matrix.build-type }}-${{ hashFiles('examples/ImGui/Makefile', 'examples/ImGui/**/*.cpp', 'examples/ImGui/**/*.h', 'examples/ImGui/**/*.hpp') }}
40+
examples/task-manager/build/
41+
examples/donut-basic/build/
42+
key: ${{ runner.os }}-build-${{ matrix.build-type }}-${{ hashFiles('examples/task-manager/makefile', 'examples/task-manager/**/*.cpp', 'examples/donut-basic/makefile', 'examples/donut-basic/**/*.cpp') }}
4243
restore-keys: |
4344
${{ runner.os }}-build-${{ matrix.build-type }}-
4445
45-
- name: Build ImGui example (${{ matrix.build-type }})
46+
- name: Build task-manager example (${{ matrix.build-type }})
4647
run: |
47-
cd examples/ImGui
48+
cd examples/task-manager
4849
if [ "$RUNNER_OS" = "macOS" ]; then
4950
make BUILD_TYPE=${{ matrix.build-type }} CXX=clang++ clean all -j$(nproc 2>/dev/null || echo 4)
5051
else
5152
make BUILD_TYPE=${{ matrix.build-type }} clean all -j$(nproc 2>/dev/null || echo 4)
5253
fi
5354
shell: bash
5455

55-
- name: Build ImGui example with analyze
56+
- name: Build donut-basic example (${{ matrix.build-type }})
57+
run: |
58+
cd examples/donut-basic
59+
if [ "$RUNNER_OS" = "macOS" ]; then
60+
make BUILD_TYPE=${{ matrix.build-type }} CXX=clang++ clean all -j$(nproc 2>/dev/null || echo 4)
61+
else
62+
make BUILD_TYPE=${{ matrix.build-type }} clean all -j$(nproc 2>/dev/null || echo 4)
63+
fi
64+
shell: bash
65+
66+
- name: Generate assembly and disassembly
67+
run: |
68+
cd examples/task-manager
69+
if [ "$RUNNER_OS" = "macOS" ]; then
70+
make CXX=clang++ asm disassemble || true
71+
else
72+
make asm disassemble || true
73+
fi
74+
shell: bash
75+
76+
- name: Build task-manager with static analysis
5677
if: matrix.build-type == 'debug' && runner.os == 'Linux'
5778
run: |
58-
cd examples/ImGui
79+
cd examples/task-manager
5980
if [ "$RUNNER_OS" = "macOS" ]; then
6081
make clean CXX=clang++ analyze
6182
else
@@ -66,7 +87,7 @@ jobs:
6687
- name: Check compilation
6788
if: matrix.os == 'ubuntu-latest'
6889
run: |
69-
cd examples/ImGui
90+
cd examples/task-manager
7091
make BUILD_TYPE=debug WARN_LEVEL=normal clean all 2>&1 | tee build.log
7192
# Count actual compilation errors (not warnings)
7293
ERROR_COUNT=$(grep -c "error:" build.log || true)
@@ -90,11 +111,19 @@ jobs:
90111
sudo apt-get update
91112
sudo apt-get install -y build-essential --no-install-recommends
92113
93-
- name: Build all examples
114+
- name: Build task-manager example
115+
run: |
116+
cd examples/task-manager
117+
make BUILD_TYPE=release clean all asm disassemble -j$(nproc)
118+
119+
- name: Build donut-basic example
94120
run: |
121+
cd examples/donut-basic
95122
make BUILD_TYPE=release clean all -j$(nproc)
96123
97-
- name: Verify executable exists
124+
- name: Verify executables
98125
run: |
99-
[ -f "examples/ImGui/build/app/ImGuiExample" ] || { echo "Executable not found!"; exit 1; }
100-
echo "✓ ImGuiExample executable built successfully"
126+
[ -f "examples/task-manager/build/app/tm" ] || { echo "task-manager executable not found!"; exit 1; }
127+
echo "✓ task-manager executable built successfully"
128+
[ -f "examples/donut-basic/build/app/donut" ] || { echo "donut-basic executable not found!"; exit 1; }
129+
echo "✓ donut-basic executable built successfully"

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ Designed to be simple, readable, and easy to extend, ideal for game engines, too
3333

3434
## 🚩 Quick Start - Run the Examples
3535

36-
In the root directory are a main **Makefile** for building two simple examples:
36+
In the root directory is a main **Makefile** for building three complete examples:
3737

3838
- **Spinning ASCII Donut**: A terminal-based 3D donut animation (in `examples/donut-basic/`)
3939
- **ImGui + GLFW Demo**: A graphical window using ImGui and GLFW (in `examples/ImGui/`)
40+
- **Task Manager CLI**: An advanced command-line task management system with JSON persistence (in `examples/task-manager/`)
4041

4142
### Clone the repository
4243

@@ -54,10 +55,16 @@ make run-donut
5455
# Option 2: Open the ImGui window (graphical demo with GLFW)
5556
make run-imgui
5657

57-
# Option 3: See available examples
58+
# Option 3: Run the task manager CLI example
59+
make run-tm
60+
61+
# Option 4: Build all examples
62+
make all
63+
64+
# Option 5: See available examples
5865
make list
5966

60-
# Option 4: Get help
67+
# Option 6: Get help
6168
make help
6269
```
6370

examples/task-manager/README.md

Whitespace-only changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#include "storage.h"
4+
#include "utils.h" // Para colores e input
5+
#include <string>
6+
7+
class CLI {
8+
public:
9+
explicit CLI(Storage& storage);
10+
11+
void showWelcome() const;
12+
void run();
13+
void showHelp() const;
14+
15+
private:
16+
Storage& storage_;
17+
18+
// Comandos
19+
void handleAdd(const std::string& desc);
20+
void handleList();
21+
void handleComplete(int id);
22+
void handleDelete(int id);
23+
24+
// Parsers (más código)
25+
std::string getCommand();
26+
void parseCommand(const std::string& input);
27+
};

0 commit comments

Comments
 (0)