summaryrefslogtreecommitdiffhomepage
path: root/public/tools/mk.fwrk/src/CommandLine.cc
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
committerAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
commitfb790b07aeba8e22e4190cf3e1834d11ecde6c96 (patch)
tree4cec7d1b321307b1d5935577631dae116a658a37 /public/tools/mk.fwrk/src/CommandLine.cc
parent63a2d92c5dfe976175cda024ec01905d11b43738 (diff)
dev: better .clang-format, ran format command.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'public/tools/mk.fwrk/src/CommandLine.cc')
-rw-r--r--public/tools/mk.fwrk/src/CommandLine.cc142
1 files changed, 66 insertions, 76 deletions
diff --git a/public/tools/mk.fwrk/src/CommandLine.cc b/public/tools/mk.fwrk/src/CommandLine.cc
index 8f142dfb..202f21bb 100644
--- a/public/tools/mk.fwrk/src/CommandLine.cc
+++ b/public/tools/mk.fwrk/src/CommandLine.cc
@@ -13,107 +13,97 @@
/// @brief This program makes a framework/app/steps directory for NeKernel OS.
-static const Char* kStepsName = "Steps";
+static const Char* kStepsName = "Steps";
static const Char* kStepsAuthor = "John Doe";
static const Char* kStepsCompany = "Company, Inc";
-SInt32 _NeMain(SInt32 argc, Char* argv[])
-{
- CF::CFArray<const char*, 256U> files;
+SInt32 _NeMain(SInt32 argc, Char* argv[]) {
+ CF::CFArray<const char*, 256U> files;
- auto ext = kFKExtension;
+ auto ext = kFKExtension;
- for (SInt32 i = 2UL; i < argc; ++i)
- {
- if (MmStrCmp(argv[i], "-h") == 0)
- {
- PrintOut(nullptr, "%s", "make_app: Framework/Application Creation Tool.\n");
- PrintOut(nullptr, "%s", "make_app: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n");
+ for (SInt32 i = 2UL; i < argc; ++i) {
+ if (MmStrCmp(argv[i], "-h") == 0) {
+ PrintOut(nullptr, "%s", "make_app: Framework/Application Creation Tool.\n");
+ PrintOut(nullptr, "%s", "make_app: © 2024-2025 Amlal El Mahrouss, All rights reserved.\n");
- PrintOut(nullptr, "%s", "make_app: -a: Application Directory.\n");
- PrintOut(nullptr, "%s", "make_app: -s: Steps (Setup pages) Directory.\n");
- PrintOut(nullptr, "%s", "make_app: -f: Framework Directory.\n");
+ PrintOut(nullptr, "%s", "make_app: -a: Application Directory.\n");
+ PrintOut(nullptr, "%s", "make_app: -s: Steps (Setup pages) Directory.\n");
+ PrintOut(nullptr, "%s", "make_app: -f: Framework Directory.\n");
- return kErrorSuccess;
- }
+ return kErrorSuccess;
+ }
- if (MmStrCmp(argv[i], "--author") == 0)
- {
- MmCopyMemory(const_cast<Char*>(kStepsAuthor), const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
- continue;
- }
+ if (MmStrCmp(argv[i], "--author") == 0) {
+ MmCopyMemory(const_cast<Char*>(kStepsAuthor), const_cast<Char*>(argv[i + 1]),
+ MmStrLen(argv[i + 1]));
+ continue;
+ }
- if (MmStrCmp(argv[i], "--company") == 0)
- {
- MmCopyMemory(const_cast<Char*>(kStepsCompany), const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
- continue;
- }
+ if (MmStrCmp(argv[i], "--company") == 0) {
+ MmCopyMemory(const_cast<Char*>(kStepsCompany), const_cast<Char*>(argv[i + 1]),
+ MmStrLen(argv[i + 1]));
+ continue;
+ }
- if (MmStrCmp(argv[i], "--name") == 0)
- {
- MmCopyMemory(const_cast<Char*>(kStepsName), const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1]));
- continue;
- }
+ if (MmStrCmp(argv[i], "--name") == 0) {
+ MmCopyMemory(const_cast<Char*>(kStepsName), const_cast<Char*>(argv[i + 1]),
+ MmStrLen(argv[i + 1]));
+ continue;
+ }
- if (MmStrCmp(argv[i], "-a") == 0)
- {
- ext = kAppExtension;
- continue;
- }
- else if (MmStrCmp(argv[i], "-s") == 0)
- {
- ext = kStepsExtension;
- continue;
- }
- else if (MmStrCmp(argv[i], "-f") == 0)
- {
- ext = kFKExtension;
- continue;
- }
+ if (MmStrCmp(argv[i], "-a") == 0) {
+ ext = kAppExtension;
+ continue;
+ } else if (MmStrCmp(argv[i], "-s") == 0) {
+ ext = kStepsExtension;
+ continue;
+ } else if (MmStrCmp(argv[i], "-f") == 0) {
+ ext = kFKExtension;
+ continue;
+ }
- files[i] = argv[i];
- }
+ files[i] = argv[i];
+ }
- auto path = argv[1];
+ auto path = argv[1];
- if (FsCreateDir(path))
- {
- FsCreateDir(StrFmt("{}{}", path, kRootDirectory));
- FsCreateDir(StrFmt("{}{}", path, kExecDirectory));
+ if (FsCreateDir(path)) {
+ FsCreateDir(StrFmt("{}{}", path, kRootDirectory));
+ FsCreateDir(StrFmt("{}{}", path, kExecDirectory));
- if (MmStrCmp(ext, kStepsExtension) == 0)
- {
- FsCreateFile(StrFmt("{}{}{}{}", path, kRootDirectory, "_setup"));
+ if (MmStrCmp(ext, kStepsExtension) == 0) {
+ FsCreateFile(StrFmt("{}{}{}{}", path, kRootDirectory, "_setup"));
- auto handle = IoOpenFile(StrFmt("{}{}{}{}", path, kRootDirectory, "_setup", kStepsExtension), nullptr);
+ auto handle =
+ IoOpenFile(StrFmt("{}{}{}{}", path, kRootDirectory, "_setup", kStepsExtension), nullptr);
- struct STEPS_COMMON_RECORD record;
+ struct STEPS_COMMON_RECORD record;
- MmFillMemory(&record, sizeof(STEPS_COMMON_RECORD), 0);
+ MmFillMemory(&record, sizeof(STEPS_COMMON_RECORD), 0);
- MmCopyMemory(record.name, const_cast<Char*>(kStepsName), kStepsStrLen);
- MmCopyMemory(record.author, const_cast<Char*>(kStepsAuthor), kStepsStrLen);
- MmCopyMemory(record.company, const_cast<Char*>(kStepsCompany), kStepsStrLen);
+ MmCopyMemory(record.name, const_cast<Char*>(kStepsName), kStepsStrLen);
+ MmCopyMemory(record.author, const_cast<Char*>(kStepsAuthor), kStepsStrLen);
+ MmCopyMemory(record.company, const_cast<Char*>(kStepsCompany), kStepsStrLen);
- MmCopyMemory(record.magic, const_cast<Char*>(kStepsMagic), kStepsMagicLen);
+ MmCopyMemory(record.magic, const_cast<Char*>(kStepsMagic), kStepsMagicLen);
- record.version = kStepsVersion;
+ record.version = kStepsVersion;
- IoWriteFile(handle, (void*)&record, sizeof(STEPS_COMMON_RECORD));
- IoCloseFile(handle);
+ IoWriteFile(handle, (void*) &record, sizeof(STEPS_COMMON_RECORD));
+ IoCloseFile(handle);
- handle = nullptr;
- }
+ handle = nullptr;
+ }
- for (auto i = 0UL; i < files.Count(); ++i)
- {
- auto& file = files[i];
+ for (auto i = 0UL; i < files.Count(); ++i) {
+ auto& file = files[i];
- FsCopy(path, StrFmt("{}{}", path, file));
- }
+ FsCopy(path, StrFmt("{}{}", path, file));
+ }
- return kErrorSuccess;
- }
+ return kErrorSuccess;
+ }
- return kErrorInternal;
+ return kErrorInternal;
}