bump: 0.3 and updated c++
This commit is contained in:
parent
301d3b0a2d
commit
988b785193
4 changed files with 38 additions and 49 deletions
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.19)
|
||||
cmake_minimum_required(VERSION 3.28.2)
|
||||
|
||||
# Get version
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/props.json PROPS)
|
||||
|
@ -8,11 +8,20 @@ project(RapidMenu
|
|||
DESCRIPTION "Utilize configuration files to create runner scripts."
|
||||
VERSION ${VER})
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
|
||||
# check if build type is set if it isnt set it to release
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(DCKMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
# Add the path to the source files for RapidMenu
|
||||
file(GLOB_RECURSE RAPID_MENU_SOURCE_FILES "src/*.cpp")
|
||||
|
||||
# add compiler flags
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-03")
|
||||
|
||||
# Add the executable target for RapidMenu
|
||||
add_executable(RapidMenu ${RAPID_MENU_SOURCE_FILES})
|
||||
install(TARGETS RapidMenu DESTINATION bin)
|
||||
|
@ -21,7 +30,6 @@ install(TARGETS RapidMenu DESTINATION bin)
|
|||
find_package(tomlplusplus REQUIRED)
|
||||
target_link_libraries(RapidMenu PRIVATE tomlplusplus::tomlplusplus)
|
||||
|
||||
|
||||
# DEBIAN
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "DRAGONTOS")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libcpptoml-dev")
|
||||
|
|
2
PKGBUILD
2
PKGBUILD
|
@ -1,6 +1,6 @@
|
|||
pkgname=RapidMenu-git
|
||||
_gitname=RapidMenu
|
||||
pkgver=0.2.4
|
||||
pkgver=0.3
|
||||
pkgrel=1
|
||||
pkgdesc="Utilize configuration files to create runner scripts."
|
||||
url="https://github.com/DRAGONTOS/RapidMenu"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"version": "0.2.4"
|
||||
"version": "0.3"
|
||||
}
|
||||
|
|
51
src/main.cpp
51
src/main.cpp
|
@ -22,8 +22,8 @@ inline void checkIfExtractionFailed() {
|
|||
}
|
||||
|
||||
std::cin.clear(); // put std::cin back into normal mode
|
||||
clearBuffer(); // remove bad input
|
||||
}
|
||||
clearBuffer(); // remove bad input
|
||||
}
|
||||
|
||||
const std::string USAGE = R"#(usage: RapidMenu [flags] [<command> [args]]
|
||||
|
@ -41,8 +41,7 @@ struct Action {
|
|||
std::string command;
|
||||
|
||||
Action(const std::string &nms = "", const std::string &desc = "",
|
||||
const std::string &cmd = "")
|
||||
: names(nms), description(desc), command(cmd) {}
|
||||
const std::string &cmd = "") : names(nms), description(desc), command(cmd) {}
|
||||
};
|
||||
|
||||
void from_toml(const cpptoml::table &t, Action &a) {
|
||||
|
@ -72,8 +71,7 @@ int main(int argc, char **argv, char **envp) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (std::filesystem::exists(rapidMenuPath) &&
|
||||
std::filesystem::is_directory(rapidMenuPath)) {
|
||||
if (std::filesystem::exists(rapidMenuPath) && std::filesystem::is_directory(rapidMenuPath)) {
|
||||
} else {
|
||||
system(rapidcommand.c_str());
|
||||
std::cerr << "Setting up the config directory: " << rapidMenuPath;
|
||||
|
@ -129,18 +127,11 @@ int main(int argc, char **argv, char **envp) {
|
|||
|
||||
namesList = namesStream.str();
|
||||
|
||||
std::string rname = config->get_table("runner")
|
||||
->get_as<std::string>("rname")
|
||||
.value_or("dashboard:");
|
||||
std::string rtheme = config->get_table("runner")
|
||||
->get_as<std::string>("rtheme")
|
||||
.value_or("");
|
||||
std::string rcommand = config->get_table("runner")
|
||||
->get_as<std::string>("rcommand")
|
||||
.value_or("rofi -dmenu -p");
|
||||
std::string rname = config->get_table("runner") ->get_as<std::string>("rname") .value_or("dashboard:");
|
||||
std::string rtheme = config->get_table("runner") ->get_as<std::string>("rtheme") .value_or("");
|
||||
std::string rcommand = config->get_table("runner") ->get_as<std::string>("rcommand") .value_or("rofi -dmenu -p");
|
||||
|
||||
std::string rofiCommand = "printf '" + namesList + "' | " + rcommand +
|
||||
" '" + rname + " ' " + rtheme;
|
||||
std::string rofiCommand = "printf '" + namesList + "' | " + rcommand + " '" + rname + " ' " + rtheme;
|
||||
FILE *rofiProcess = popen(rofiCommand.c_str(), "r");
|
||||
|
||||
char buffer[256];
|
||||
|
@ -150,9 +141,7 @@ int main(int argc, char **argv, char **envp) {
|
|||
userChoice += buffer;
|
||||
}
|
||||
|
||||
userChoice.erase(remove_if(userChoice.begin(), userChoice.end(),
|
||||
[](char c) { return c == '\n'; }),
|
||||
userChoice.end());
|
||||
userChoice.erase(remove_if(userChoice.begin(), userChoice.end(), [](char c) { return c == '\n'; }), userChoice.end());
|
||||
for (const auto &tableItem : *config) {
|
||||
try {
|
||||
const auto &table = tableItem.second->as_table();
|
||||
|
@ -195,8 +184,7 @@ int main(int argc, char **argv, char **envp) {
|
|||
std::string bindir = std::string(userHome) + "/.local/bin";
|
||||
std::string createbindir = "mkdir -p " + bindir;
|
||||
|
||||
if (std::filesystem::exists(bindir) &&
|
||||
std::filesystem::is_directory(bindir)) {
|
||||
if (std::filesystem::exists(bindir) && std::filesystem::is_directory(bindir)) {
|
||||
} else {
|
||||
system(createbindir.c_str());
|
||||
std::cerr << "Setting up bin dir.";
|
||||
|
@ -205,13 +193,11 @@ int main(int argc, char **argv, char **envp) {
|
|||
|
||||
// config
|
||||
std::string bconfigfile = bconfigin;
|
||||
if (std::filesystem::exists(bconfigfile) &&
|
||||
std::filesystem::is_regular_file(bconfigfile)) {
|
||||
if (std::filesystem::exists(bconfigfile) && std::filesystem::is_regular_file(bconfigfile)) {
|
||||
bconfig = argv[2];
|
||||
|
||||
} else {
|
||||
while (!(std::filesystem::exists(bconfigfile) &&
|
||||
std::filesystem::is_regular_file(bconfigfile))) {
|
||||
while (!(std::filesystem::exists(bconfigfile) && std::filesystem::is_regular_file(bconfigfile))) {
|
||||
std::cout << "Invalid config file: " << bconfigfile << ' ';
|
||||
std::cout << "Please enter a valid config: ";
|
||||
std::cin >> bconfigfile;
|
||||
|
@ -228,10 +214,8 @@ int main(int argc, char **argv, char **envp) {
|
|||
clearBuffer();
|
||||
std::string bexefile = std::string(userHome) + "/.local/bin/" + bexeout;
|
||||
|
||||
if (std::filesystem::exists(bexefile) &&
|
||||
std::filesystem::is_regular_file(bexefile)) {
|
||||
while (std::filesystem::exists(bexefile) &&
|
||||
std::filesystem::is_regular_file(bexefile)) {
|
||||
if (std::filesystem::exists(bexefile) && std::filesystem::is_regular_file(bexefile)) {
|
||||
while (std::filesystem::exists(bexefile) && std::filesystem::is_regular_file(bexefile)) {
|
||||
std::cout << "do you want to overwrite: " << bexeout << "? (y/n) ";
|
||||
std::cin >> byn;
|
||||
checkIfExtractionFailed();
|
||||
|
@ -256,13 +240,10 @@ int main(int argc, char **argv, char **envp) {
|
|||
|
||||
system(("touch " + bexefile + std::string(bexe)).c_str());
|
||||
system(("chmod +x " + bexefile + std::string(bexe)).c_str());
|
||||
system(("echo '#!/usr/bin/env bash' > " + bexefile + std::string(bexe))
|
||||
.c_str());
|
||||
system(("echo 'RapidMenu -c " + std::string(bconfig) + "' >> " +
|
||||
std::string(bexe))
|
||||
.c_str());
|
||||
|
||||
system(("echo '#!/usr/bin/env bash' > " + bexefile + std::string(bexe)).c_str());
|
||||
system(("echo 'RapidMenu -c " + std::string(bconfig) + "' >> " + std::string(bexe)).c_str());
|
||||
break;
|
||||
|
||||
} else {
|
||||
std::cerr << USAGE;
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue