remembered that versioning exist
All checks were successful
build_test / build (push) Successful in 2m30s
All checks were successful
build_test / build (push) Successful in 2m30s
This commit is contained in:
parent
00f261696f
commit
e6961d6d6d
@ -3,7 +3,7 @@
|
||||
#ifndef NAME
|
||||
|
||||
#define NAME "ParaDocs"
|
||||
#define VERSION "0.0.1"
|
||||
#define VERSION "1.0.0"
|
||||
|
||||
inline constexpr auto hash_djb2a(const std::string_view sv) {
|
||||
unsigned long hash{5381};
|
||||
@ -13,7 +13,7 @@ inline constexpr auto hash_djb2a(const std::string_view sv) {
|
||||
return hash;
|
||||
}
|
||||
|
||||
inline constexpr auto operator""_sh(const char* str, size_t len) {
|
||||
inline constexpr auto operator""_sh(const char *str, size_t len) {
|
||||
return hash_djb2a(std::string_view{str, len});
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ void PrintHelp() {
|
||||
}
|
||||
|
||||
void PrintVersion() {
|
||||
std::cout << NAME << loc_strings->version << ": " << VERSION << "\n";
|
||||
std::cout << NAME << " " << loc_strings->version << ": " << VERSION << "\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
66
src/menu.cpp
66
src/menu.cpp
@ -19,7 +19,6 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <menu.h>
|
||||
#include <ncurses.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
@ -84,20 +83,25 @@ void reload_menu_from_directory(complete_menu &main_menu) {
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(name_date); i++) {
|
||||
std::getline(ssfn, name_date[i], '_');
|
||||
}
|
||||
try {
|
||||
json complaint_json = json::parse(file);
|
||||
|
||||
json complaint_json = json::parse(file);
|
||||
if (complaint_json["status"].is_null() ||
|
||||
complaint_json["status"].get<uint8_t>() >= STATUS_COUNT) {
|
||||
std::cerr << "Invalid status in file: "
|
||||
<< directroy_entry.path().filename().string() << std::endl;
|
||||
safe_exit(EINVAL);
|
||||
if (complaint_json["status"].is_null() ||
|
||||
complaint_json["status"].get<uint8_t>() >= STATUS_COUNT) {
|
||||
std::cerr << "Invalid status in file: "
|
||||
<< directroy_entry.path().filename().string()
|
||||
<< std::endl;
|
||||
safe_exit(EINVAL);
|
||||
}
|
||||
|
||||
name_date[1].append(" ");
|
||||
name_date[1].append(
|
||||
loc_strings
|
||||
->status_strings[complaint_json["status"].get<uint8_t>()]);
|
||||
} catch (...) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name_date[1].append(" ");
|
||||
name_date[1].append(
|
||||
loc_strings
|
||||
->status_strings[complaint_json["status"].get<uint8_t>()]);
|
||||
|
||||
char *name = new char[name_date[0].length() + 1];
|
||||
main_menu_allocated.push_back({GENERIC_TYPE, name, 1});
|
||||
char *date = new char[name_date[1].length() + 1];
|
||||
@ -162,18 +166,22 @@ void menu() {
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(name_date); i++) {
|
||||
std::getline(ssfn, name_date[i], '_');
|
||||
}
|
||||
json complaint_json = json::parse(file);
|
||||
if (complaint_json["status"].is_null() ||
|
||||
complaint_json["status"].get<size_t>() >= STATUS_COUNT) {
|
||||
std::cerr << "Invalid status in file: "
|
||||
<< directroy_entry.path().filename().string()
|
||||
<< std::endl;
|
||||
safe_exit(EINVAL);
|
||||
try {
|
||||
json complaint_json = json::parse(file);
|
||||
if (complaint_json["status"].is_null() ||
|
||||
complaint_json["status"].get<size_t>() >= STATUS_COUNT) {
|
||||
std::cerr << "Invalid status in file: "
|
||||
<< directroy_entry.path().filename().string()
|
||||
<< std::endl;
|
||||
safe_exit(EINVAL);
|
||||
}
|
||||
name_date[1].append(" ");
|
||||
name_date[1].append(
|
||||
loc_strings
|
||||
->status_strings[complaint_json["status"].get<uint8_t>()]);
|
||||
} catch (...) {
|
||||
continue;
|
||||
}
|
||||
name_date[1].append(" ");
|
||||
name_date[1].append(
|
||||
loc_strings
|
||||
->status_strings[complaint_json["status"].get<uint8_t>()]);
|
||||
|
||||
char *name = new char[name_date[0].length() + 1];
|
||||
main_menu_allocated.push_back({GENERIC_TYPE, name, 1});
|
||||
@ -252,11 +260,15 @@ void menu() {
|
||||
<< "\n";
|
||||
exit(EINVAL);
|
||||
}
|
||||
try {
|
||||
json selected_file_json = json::parse(selected_file);
|
||||
|
||||
json selected_file_json = json::parse(selected_file);
|
||||
|
||||
printDocument(selected_file_json["complaint_text"].get<std::string>());
|
||||
current_allocated = &main_menu_allocated;
|
||||
printDocument(
|
||||
selected_file_json["complaint_text"].get<std::string>());
|
||||
current_allocated = &main_menu_allocated;
|
||||
} catch (...) {
|
||||
safe_exit(EINVAL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "easy_edit"_sh:
|
||||
|
Loading…
x
Reference in New Issue
Block a user