You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add a comment header listing supported flags and known differences from GNU.
141
-
2. Declare the function in [applets.hpp](include/cfbox/applets.hpp).
142
-
3. Add one entry to `APPLET_REGISTRY` in [applets.hpp](include/cfbox/applets.hpp).
143
-
4. Add GTest unit tests in `tests/unit/test_<name>.cpp` (see [test_capture.hpp](tests/unit/test_capture.hpp) for stdout capture and `TempDir` utilities).
144
-
5. Add shell integration tests in `tests/integration/test_<name>.sh` following the pattern in existing scripts.
141
+
- Add a `constexpr cfbox::help::HelpEntry HELP` constant in the anonymous namespace.
142
+
- Handle `--help` / `--version` right after `args::parse()`:
143
+
```cpp
144
+
if (parsed.has_long("help")) { cfbox::help::print_help(HELP); return 0; }
145
+
if (parsed.has_long("version")) { cfbox::help::print_version(HELP); return 0; }
146
+
```
147
+
2. Declare the function in [applets.hpp](include/cfbox/applets.hpp), guarded by `#if CFBOX_ENABLE_<UPPER>`.
148
+
3. Add one entry to `APPLET_REGISTRY` in [applets.hpp](include/cfbox/applets.hpp), also guarded by `#if CFBOX_ENABLE_<UPPER>`.
149
+
4. Add the applet name to the `CFBOX_APPLETS` list in [cmake/Config.cmake](cmake/Config.cmake).
150
+
5. Add a `#cmakedefine01 CFBOX_ENABLE_<UPPER>` line to [include/cfbox/applet_config.hpp.in](include/cfbox/applet_config.hpp.in).
151
+
6. Add GTest unit tests in `tests/unit/test_<name>.cpp` (see [test_capture.hpp](tests/unit/test_capture.hpp) for stdout capture and `TempDir` utilities). Guard the test file with `#if CFBOX_ENABLE_<UPPER>`.
152
+
7. Add shell integration tests in `tests/integration/test_<name>.sh` following the pattern in existing scripts.
145
153
146
-
> **Note:** The `init` applet is special — it runs as PID 1 in QEMU system-mode tests. Regular applets should not need special PID 1 handling.
154
+
> **Note:** The `init` applet is special — it runs as PID 1 in QEMU system-mode tests and uses manual `argv` scanning instead of `args::parse()`. Regular applets should not need special PID 1 handling.
155
+
156
+
## Build Configuration
157
+
158
+
CFBox supports per-applet configuration via CMake options:
CFBox is a single-executable Unix utility collection distributed via symbolic links. All development is complete — 17 applets implemented and tested, with a CI pipeline covering native builds, cross-compilation, and QEMU user/system-mode testing across 5 stages.
16
+
CFBox is a single-executable Unix utility collection distributed via symbolic links. 17 applets implemented and tested, with a CI pipeline covering native builds, cross-compilation, and QEMU user/system-mode testing across 5 stages. Features configurable CMake builds (per-applet toggles), GNU-style long options, and colored help output.
17
17
18
18
**Design philosophy:** Simplicity first — Modern C++ (`std::expected`) — Embedded-friendly (cross-compilation, static linking)
19
19
@@ -25,8 +25,8 @@ cmake -B build
25
25
cmake --build build
26
26
27
27
# Test
28
-
ctest --test-dir build --output-on-failure #108 GTest unit tests
29
-
bash tests/integration/run_all.sh #16 integration test scripts
28
+
ctest --test-dir build --output-on-failure #149 GTest unit tests
29
+
bash tests/integration/run_all.sh #17 integration test scripts
30
30
31
31
# Run via subcommand
32
32
./build/cfbox echo"Hello, World!"
@@ -42,7 +42,7 @@ echo "Hello, World!" # now calls cfbox via symlink
42
42
43
43
| Applet | Supported Flags / Features |
44
44
|--------|----------------------------|
45
-
|`echo`|`-n` (no trailing newline), `-e` (interpret escape sequences) |
45
+
|`echo`|`-n` (no trailing newline), `-e` (interpret escape sequences), all applets support `--help` / `--version`|
46
46
|`printf`| Format strings (`%s``%d``%f``%c``%%`), format reuse |
0 commit comments