Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge all the changes from libalpm-test to main #8

Merged
merged 125 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
60f638e
make db colors more cooler
Toni500github Mar 11, 2024
670b274
Merge branch 'dev' of https://github.com/BurntRanch/TabAUR into dev
BurntRanch Mar 11, 2024
00ad67a
Merge pull request #3 from BurntRanch/dev
BurntRanch Mar 11, 2024
c8e8d75
Update taur.cpp
BurntRanch Mar 11, 2024
ceb9a47
fixing bug with chocolate
Toni500github Mar 14, 2024
64fcb80
cpr submodule is at it's latest stable version
Toni500github Mar 14, 2024
31f0bc7
temp fix github actions
Toni500github Mar 14, 2024
55ac9e6
Giant update
BurntRanch Mar 14, 2024
cacc937
use pacman for other args
Toni500github Mar 15, 2024
670e583
small but good update
Toni500github Mar 19, 2024
6063236
Added a forgotten include/ini.h
BurntRanch Mar 21, 2024
52dbd30
use toml++ template library + let's make the code a bit more cleaner
Toni500github Mar 21, 2024
fef51d1
Merge branch 'dev' into libalpm-test
BurntRanch Mar 21, 2024
807d398
Update util.hpp
BurntRanch Mar 21, 2024
6dc36a0
Update taur.cpp
BurntRanch Mar 21, 2024
834bc24
Update util.hpp
BurntRanch Mar 21, 2024
af2b9dc
Merge pull request #4 from BurntRanch/libalpm-test
BurntRanch Mar 21, 2024
352a76f
Revert "Merge the cool changes that happened"
BurntRanch Mar 21, 2024
c6e0a60
Merge pull request #5 from BurntRanch/revert-4-libalpm-test
BurntRanch Mar 21, 2024
367fc4d
Dumping all my changes before formatting
BurntRanch Mar 22, 2024
7a06ac9
replace libgit2 with git
Toni500github Mar 22, 2024
84df59b
let's use fork()+execvp() instead of system()
Toni500github Mar 22, 2024
1f3fbab
finishing it
Toni500github Mar 22, 2024
4797e1b
Merge branch 'libalpm-test' into libalpm-execlp
BurntRanch Mar 23, 2024
7be1f9a
Merge pull request #6 from BurntRanch/libalpm-execlp
BurntRanch Mar 23, 2024
d229d84
fixed taur -R when selecting *
Toni500github Mar 23, 2024
22cc002
fix crash when pkg description is empty
Toni500github Mar 23, 2024
5d94877
Readded libalpm functionality that got removed + other things
BurntRanch Mar 23, 2024
3284d7d
Fixed multiple bugs
BurntRanch Mar 23, 2024
343571e
Fixed a memory leak
BurntRanch Mar 23, 2024
330b46b
Yeah
BurntRanch Mar 23, 2024
e8cb5b4
newline
BurntRanch Mar 23, 2024
1a7695e
adding debug option + colors are now optional (for real)
Toni500github Mar 24, 2024
c37a2b1
running clang-format
Toni500github Mar 24, 2024
ac3d9d5
i don't like this
Toni500github Mar 24, 2024
2c31818
Merge branch 'libalpm-test' into libalpm-test-1
BurntRanch Mar 24, 2024
7cbc9d0
Merge pull request #7 from BurntRanch/libalpm-test-1
BurntRanch Mar 24, 2024
f55863d
Fixed up the messages
BurntRanch Mar 24, 2024
12117d1
merge
BurntRanch Mar 24, 2024
e66ed24
Fixed up the code!1
BurntRanch Mar 25, 2024
00184d8
Made messages clearer
BurntRanch Mar 25, 2024
687bd86
Bumped up version to 0.1.0
BurntRanch Mar 25, 2024
968a8e2
I should start testing my code
BurntRanch Mar 25, 2024
4e3a41b
Performance update for searching package
BurntRanch Mar 27, 2024
12bb7d6
no need to use _() with log_printf()
Toni500github Mar 27, 2024
966faf0
I hope these colors now works without #define
Toni500github Mar 27, 2024
c3a5dea
add more pacman options + code cleanup + optional git binary
Toni500github Mar 27, 2024
d410536
remove -O3 + debug is true by default + fix running pacman -Syu with -a
Toni500github Mar 28, 2024
5b4cd30
no ending '\n' at each log_printf()
Toni500github Mar 28, 2024
cb6adfd
fix pkg version comparing
Toni500github Mar 28, 2024
2e49081
print versions with -Q + use some makepkg commands
Toni500github Mar 28, 2024
9698ea4
Big update
Toni500github Mar 29, 2024
6ee14f2
Added taur_read_exec, a function that can read from execvp's stdout.
BurntRanch Mar 29, 2024
4936bcf
Big Breaking News: TabAUR now has pacman-like options
Toni500github Mar 29, 2024
6ee2862
merge conflict
Toni500github Mar 29, 2024
78a6ad4
codebase changes
BurntRanch Mar 29, 2024
7f1a790
config->sudo
BurntRanch Mar 29, 2024
03e9509
Revert "no ending '\n' at each log_printf()"
Toni500github Mar 29, 2024
f4e065a
Fixed a bug with -Q making everything else green.
BurntRanch Mar 29, 2024
322daf6
Merge branch 'libalpm-test' of https://github.com/BurntRanch/TabAUR i…
BurntRanch Mar 29, 2024
e100fe7
colors update
Toni500github Mar 29, 2024
571ad4c
remove LOG_FATAL and some code cleanup
Toni500github Mar 30, 2024
3e001d7
opsie
Toni500github Mar 30, 2024
fcc5ecf
adding fmtlib
Toni500github Mar 31, 2024
fd415ef
convert std::cout to fmt::print
Toni500github Mar 31, 2024
d5aea89
Fixed bug with -R not being recognized as "requiring sudo"
BurntRanch Mar 31, 2024
49fa431
trying to make theme.toml possible
Toni500github Apr 1, 2024
2e037d8
Added custom theme support!
BurntRanch Apr 1, 2024
121b612
Fixed index printing
BurntRanch Apr 1, 2024
c009e06
Fixed printing errors
BurntRanch Apr 1, 2024
f2d76fb
Fixed printing errors
BurntRanch Apr 1, 2024
6b1f7c9
use global color names
Toni500github Apr 1, 2024
f4ad9e2
Fixed a problem with packages that have 'any' as their arch
BurntRanch Apr 1, 2024
b9da477
fix makepkg_list() and printPkgInfo()
Toni500github Apr 1, 2024
a41112f
remove that
Toni500github Apr 1, 2024
883913a
Merge + Removed cfg argument from several util functions.
BurntRanch Apr 2, 2024
117bb00
add --test-colors (-t)
Toni500github Apr 2, 2024
5e8062e
fix --test-colors
Toni500github Apr 2, 2024
1e4cbc5
Add warning for new users and showing popularity for packages.
BurntRanch Apr 2, 2024
2a2ca1a
Increased popularity for system packages
BurntRanch Apr 2, 2024
25f4fa9
Lacking .config means you lack the 2 other files eitherway.
BurntRanch Apr 2, 2024
55cfb68
Added more verbose logging for compilation
BurntRanch Apr 2, 2024
15da0ae
make these colors a bit brighter by default
Toni500github Apr 2, 2024
1c6ea45
Some micro-optimizations
BurntRanch Apr 2, 2024
a60ecc8
Merge branch 'libalpm-test' of https://github.com/BurntRanch/TabAUR i…
BurntRanch Apr 2, 2024
ecad057
downgraded back to std=c++17
BurntRanch Apr 2, 2024
9c8c0d6
remove fmt submodule + update PKGBUILD version
Toni500github Apr 2, 2024
bf671d1
fix arch in makepkg_list()
Toni500github Apr 2, 2024
8c49324
Balance change
BurntRanch Apr 3, 2024
57d1347
Balance Changes
BurntRanch Apr 3, 2024
9dcb8eb
Merge branch 'libalpm-test' of https://github.com/BurntRanch/TabAUR i…
BurntRanch Apr 3, 2024
ef99707
add disable_colors and some changes
Toni500github Apr 3, 2024
bd5dfa4
micro-optimazation
Toni500github Apr 3, 2024
b0d9bee
another mini-optimization but fr
Toni500github Apr 3, 2024
bba9785
add MakepkgConf option
Toni500github Apr 4, 2024
5f7381f
check better if cpr is already installed
Toni500github Apr 4, 2024
5a9980f
good update
BurntRanch Apr 4, 2024
8cd1830
Merge branch 'libalpm-test' of https://github.com/BurntRanch/TabAUR i…
BurntRanch Apr 4, 2024
365441a
add comments documentation
Toni500github Apr 5, 2024
e3da534
oops
Toni500github Apr 5, 2024
c4829ce
Added error handling for $HOME
BurntRanch Apr 5, 2024
6286b31
Merge branch 'libalpm-test' of https://github.com/BurntRanch/TabAUR i…
BurntRanch Apr 5, 2024
2e367fc
Optimizations, I guess.
BurntRanch Apr 5, 2024
8a6cf93
fixed some memory leaks and other bugs
BurntRanch Apr 6, 2024
85b7118
?
BurntRanch Apr 6, 2024
8c9204f
sorry + fixed bug with sysupgrade
BurntRanch Apr 6, 2024
76a1015
my social security number was leaked gg im cooked
BurntRanch Apr 6, 2024
4ab0747
add some arg options config
Toni500github Apr 6, 2024
392bbcd
organize args.cpp
Toni500github Apr 7, 2024
c5afeff
fix an insane bug that creates a folder named ~
BurntRanch Apr 7, 2024
2e03ffc
add --colors
Toni500github Apr 7, 2024
1ec5795
add --config and --theme for custom files
Toni500github Apr 7, 2024
b8b5409
automatically disable colors when is set
Toni500github Apr 8, 2024
2279e5a
Removed all clang warnings and silenced 1 g++ warning, oh and i also …
BurntRanch Apr 8, 2024
5608e86
Bug patches + version bump
BurntRanch Apr 8, 2024
e796a70
after hard thought and consideration we decided this project is about…
BurntRanch Apr 8, 2024
17dc958
add -q for query
Toni500github Apr 9, 2024
36e59e1
use fmt::println instead of log_printf(LOG_NONE)
Toni500github Apr 9, 2024
905bffa
proper help display
Toni500github Apr 9, 2024
1507b17
clean out unused function and fix mismatched return type in installPkg
BurntRanch Apr 10, 2024
ec00654
Fixed non-working newlines in the custom fork of libfmt
BurntRanch Apr 10, 2024
760c039
micro optimization: avoid getting syncdb when we don't need it
BurntRanch Apr 10, 2024
62c2f16
fix better fmt::println() for colors
Toni500github Apr 10, 2024
c3bba35
Fixed a weird bug relating to pointers not passing the right addresses
BurntRanch Apr 10, 2024
3ecbc45
Update version in PKGBUILD
BurntRanch Apr 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
CXX ?= g++
SRC = $(sort $(wildcard src/*.cpp))
OBJ = $(SRC:.cpp=.o)
LIBS ?= -lgit2 -lcpr -lalpm
LIBS ?= -lcpr -lalpm
LDFLAGS = ${LIBS}
TARGET = taur
CPPFLAGS = -isystem include -Wall -std=c++17
CPPFLAGS = -ggdb -pedantic -funroll-all-loops -march=native -isystem include -Wall -std=c++17

cpr_installed := $(shell test -s /usr/lib/libcpr.so.1 || test -s /usr/local/lib/libcpr.so.1 && echo -n yes)
is_cpr_installed := $(shell ldconfig -p | grep libcpr > /dev/null && echo -n yes)

# let's not build cpr everytime if it's already installed (support by pacman installed)
ifneq ($(cpr_installed), yes)
# let's not build cpr everytime if it's already installed
ifneq ($(is_cpr_installed), yes)
all: cpr $(TARGET)
else
all: $(TARGET)
endif

cpr:
#git submodule init
#git submodule update --init --recursive
#git -C $@ checkout 3b15fa8
cmake -S $@ -B $@/build -DCMAKE_BUILD_TYPE=Release -DCPR_BUILD_TESTS=OFF -DCPR_USE_SYSTEM_CURL=ON
cmake --build $@/build --parallel
sudo cmake --install $@/build --prefix /usr

ifneq ($(cpr_installed), yes)
ifneq ($(is_cpr_installed), yes)
$(TARGET): cpr ${OBJ}
else
$(TARGET): ${OBJ}
endif
${CXX} $(OBJ) $(CPPFLAGS) -o $@ $(LDFLAGS)

clean:
rm -rf taur src/*.o cpr/build
rm -rf taur $(OBJ) cpr/build

.PHONY: cpr taur clean all
4 changes: 2 additions & 2 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pkgname="TabAUR-git"
pkgver=0.0.1
pkgver=0.5.8
pkgrel=1
pkgdesc="A lightweight AUR helper, designed to be simple but powerful."
arch=('x86_64' 'aarch64')
url="https://example.com/"
license=('GPL3')
depends=('pacman' 'tar' 'libgit2')
depends=('pacman' 'tar')
optdepends=(
'sudo: privilege elevation'
'doas: privilege elevation'
Expand Down
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@
TabAUR is an AUR Helper that actually makes releases and it's written in C++, It supports downloading AUR Repositories with tarballs or git

### Compilation
Just run `make`.
Just run `make`.

If the compilation time is too slow, use `make -j$(nproc)` and it will use 100% of your CPU, making the compilation way faster.

### Cleaning
To clean, run `make clean`.

## Dependencies
you need to install libgit2 and [cpr](https://github.com/libcpr/cpr).

For `libgit2` can be installed by this command
```
sudo pacman -S libgit2
```
For cpr,
you need to install [cpr](https://github.com/libcpr/cpr)
TabAUR offers the choice to either use the [AUR version](https://aur.archlinux.org/packages/cpr) (recommended)

Or by compiling and installing from source with the following commands:
Or by compiling and installing from here with the following command:
```bash
git submodule init
git submodule update --init --recursive
make cpr
make
make cpr && make
```
**NOTE:** using the compiled from source version can lead to bugs or errors.
36 changes: 36 additions & 0 deletions ReleaseMakeFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
CXX ?= g++
SRC = $(sort $(wildcard src/*.cpp))
OBJ = $(SRC:.cpp=.o)
LIBS ?= -lcpr -lalpm
LDFLAGS = ${LIBS}
TARGET = taur
CPPFLAGS = -O3 -pedantic -funroll-all-loops -march=native -isystem include -Wall -std=c++17

is_cpr_installed := $(shell ldconfig -p | grep libcpr > /dev/null && echo -n yes)

# let's not build cpr everytime if it's already installed
ifneq ($(is_cpr_installed), yes)
all: cpr $(TARGET)
else
all: $(TARGET)
endif

cpr:
#git submodule init
#git submodule update --init --recursive
#git -C $@ checkout 3b15fa8
cmake -S $@ -B $@/build -DCMAKE_BUILD_TYPE=Release -DCPR_BUILD_TESTS=OFF -DCPR_USE_SYSTEM_CURL=ON
cmake --build $@/build --parallel
sudo cmake --install $@/build --prefix /usr

ifneq ($(is_cpr_installed), yes)
$(TARGET): cpr ${OBJ}
else
$(TARGET): ${OBJ}
endif
${CXX} $(OBJ) $(CPPFLAGS) -o $@ $(LDFLAGS)

clean:
rm -rf taur $(OBJ) cpr/build

.PHONY: cpr taur clean all
3 changes: 3 additions & 0 deletions compile_flags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
-I./include
-pedantic
-Wall
-std=c++17
2 changes: 1 addition & 1 deletion cpr
Submodule cpr updated 89 files
+3 −3 .github/workflows/build-deb.yml
+2 −2 .github/workflows/build-nuget.yml
+451 −159 .github/workflows/ci.yml
+2 −5 .github/workflows/clang-format.yml
+1 −1 .github/workflows/clang-tidy.yml
+71 −0 .github/workflows/codeql-analysis.yml
+1 −1 .github/workflows/cppcheck.yml
+0 −27 .github/workflows/readme-updater.yml
+9 −11 CMakeLists.txt
+6 −17 README.md
+0 −11 cmake/std_fs_support_test.cpp
+2 −2 cmake/zlib_external.cmake
+17 −11 cpr/CMakeLists.txt
+1 −2 cpr/accept_encoding.cpp
+0 −1 cpr/bearer.cpp
+2 −2 cpr/callback.cpp
+0 −2 cpr/cert_info.cpp
+0 −5 cpr/cookies.cpp
+0 −1 cpr/cprtypes.cpp
+2 −4 cpr/curl_container.cpp
+0 −3 cpr/curlholder.cpp
+2 −2 cpr/curlmultiholder.cpp
+1 −2 cpr/error.cpp
+0 −3 cpr/file.cpp
+3 −9 cpr/interceptor.cpp
+0 −4 cpr/multipart.cpp
+12 −20 cpr/multiperform.cpp
+8 −2 cpr/parameters.cpp
+8 −2 cpr/payload.cpp
+5 −15 cpr/proxyauth.cpp
+0 −1 cpr/redirect.cpp
+1 −14 cpr/response.cpp
+127 −172 cpr/session.cpp
+6 −21 cpr/ssl_ctx.cpp
+0 −6 cpr/threadpool.cpp
+1 −2 cpr/timeout.cpp
+5 −17 cpr/util.cpp
+5 −39 include/CMakeLists.txt
+2 −2 include/cpr/api.h
+1 −1 include/cpr/async_wrapper.h
+1 −1 include/cpr/buffer.h
+1 −3 include/cpr/cert_info.h
+4 −4 include/cpr/cookies.h
+3 −3 include/cpr/cprtypes.h
+4 −3 include/cpr/curlholder.h
+1 −1 include/cpr/curlmultiholder.h
+4 −4 include/cpr/file.h
+1 −1 include/cpr/interceptor.h
+1 −1 include/cpr/limit_rate.h
+1 −1 include/cpr/local_port.h
+1 −1 include/cpr/local_port_range.h
+0 −2 include/cpr/multipart.h
+2 −2 include/cpr/multiperform.h
+1 −1 include/cpr/parameters.h
+1 −1 include/cpr/payload.h
+8 −16 include/cpr/proxyauth.h
+5 −5 include/cpr/redirect.h
+12 −12 include/cpr/resolve.h
+14 −37 include/cpr/session.h
+27 −28 include/cpr/singleton.h
+1 −1 include/cpr/ssl_ctx.h
+24 −21 include/cpr/ssl_options.h
+2 −2 include/cpr/status_codes.h
+0 −2 include/cpr/util.h
+1 −1 test/alternating_tests.cpp
+2 −2 test/async_tests.cpp
+10 −13 test/callback_tests.cpp
+1 −1 test/delete_tests.cpp
+2 −14 test/download_tests.cpp
+3 −3 test/encoded_auth_tests.cpp
+2 −2 test/error_tests.cpp
+1 −17 test/get_tests.cpp
+2 −2 test/head_tests.cpp
+21 −22 test/httpServer.cpp
+1 −1 test/httpsServer.hpp
+3 −3 test/multiasync_tests.cpp
+2 −2 test/multiperform_tests.cpp
+1 −1 test/options_tests.cpp
+1 −1 test/patch_tests.cpp
+2 −2 test/post_tests.cpp
+1 −1 test/prepare_tests.cpp
+1 −1 test/proxy_tests.cpp
+1 −1 test/put_tests.cpp
+2 −2 test/raw_body_tests.cpp
+25 −117 test/session_tests.cpp
+4 −4 test/ssl_tests.cpp
+2 −2 test/structures_tests.cpp
+2 −2 test/util_tests.cpp
+1 −1 test/version_tests.cpp
54 changes: 41 additions & 13 deletions include/args.hpp
Original file line number Diff line number Diff line change
@@ -1,30 +1,58 @@
#ifndef ARGS_HPP
#define ARGS_HPP

#include <string>
#include "util.hpp"
#include <alpm.h>
#include <sys/types.h>
#include <vector>
#include <getopt.h>

enum OperationType {
OP_SYNC = 1, // when you run taur -S[args]
OP_REM = 2, // when you run taur -R[args]
OP_QUERY = 3,
OP_SYSUPGRADE,
OP_PACMAN // when it's different from -S, we gonna use pacman
enum {
OP_MAIN = 1,
OP_SYNC, // when you run taur -S[args]
OP_REM, // when you run taur -R[args]
OP_QUERY,
OP_PACMAN, // when it's different from -S,R,Q we gonna use pacman
};

enum {
OP_ASK = 1000,
OP_CACHEDIR,
OP_AURONLY,
OP_SUDO,
OP_USEGIT,
OP_REFRESH,
OP_SYSUPGRADE,
OP_COLORS,
OP_DEBUG,
OP_CONFIG,
OP_THEME,
OP_SEARCH,
OP_QUIET,
OP_TEST_COLORS,
};

struct Operation_t {
u_short op;
u_short op_sync;
u_short op_upgrade;
u_short op_s_sync;
u_short op_s_upgrade;
u_short op_s_search;
u_short op_s_pacman;

bool requires_root = false;
u_short help;
u_short version;
u_short test_colors;

std::vector<std::string> args;
};

extern struct Operation_t operation;

int parseargs(int argc, char* argv[]);
int parsearg_op(int opt);
extern struct Operation_t op;
extern alpm_list_smart_deleter taur_targets;

int parsearg_op(int opt, int dryrun);
void invalid_opt();
int parsearg_global(int opt);
int parsearg_query(int opt);
int parsearg_sync(int opt);
#endif
134 changes: 106 additions & 28 deletions include/config.hpp
Original file line number Diff line number Diff line change
@@ -1,68 +1,146 @@
#ifndef CONFIG_HPP
#define CONFIG_HPP

#include <string>
#include <util.hpp>
#define TOML_HEADER_ONLY 1
#include <toml.hpp>
#include <alpm.h>
#include <map>
#include <type_traits>
#define TOML_HEADER_ONLY 0
#include "toml.hpp"
#include "fmt/color.h"

using std::string;
using std::optional;

// so we don't need to include util.hpp for getConfigValue()
string expandVar(string& str);

enum types {
STR,
BOOL
};

struct strOrBool {
types valueType;
string stringValue = "";
bool boolValue = false;
};

class Config {
public:
bool useGit;
bool aurOnly;
alpm_handle_t *handle = nullptr;
alpm_list_t *repos = nullptr;
string makepkgBin;
string cacheDir;
string sudo;
string git;
string makepkgConf;
bool aurOnly;
bool useGit;
bool colors;
bool secretRecipe;
bool debug;
bool quiet;

std::map<string, strOrBool> overrides;

Config();
string getHomeCacheDir();
string getCacheDir();
string getHomeConfigDir();
string getConfigDir();
~Config();

void init(string configFile, string themeFile);
void initializeVars();

bool isInitialized();

void loadConfigFile(string filename);
void loadPacmanConfigFile(string filename);
void loadThemeFile(string filename);

// stupid c++ that wants template functions in header
template<typename T>
template <typename T>
T getConfigValue(string value, T fallback) {
optional<T> ret = this->tbl.at_path(value).value<T>();
if constexpr (is_string<T>::value) // if we get a value that's a string
return ret ? expandHome(ret.value()) : expandHome(fallback);
auto overridePos = overrides.find(value);

// user wants a bool (overridable), we found an override matching the name, and the override is a bool.
if constexpr(std::is_same<T, bool>())
if (overridePos != overrides.end() && overrides[value].valueType == BOOL)
return overrides[value].boolValue;

// user wants a str (overridable), we found an override matching the name, and the override is a str.
if constexpr(std::is_same<T, string>())
if (overridePos != overrides.end() && overrides[value].valueType == STR)
return overrides[value].stringValue;

toml::optional<T> ret = this->tbl.at_path(value).value<T>();
if constexpr (toml::is_string<T>) // if we want to get a value that's a string
return ret ? expandVar(ret.value()) : expandVar(fallback);
else
return ret ? ret.value() : fallback;
return ret.value_or(fallback);
}

fmt::rgb getThemeValue(string value, string fallback);
string getThemeHexValue(string value, string fallback);

private:
toml::table tbl;
toml::table tbl, theme_tbl;
bool initialized = false;
};

extern Config config;
extern std::unique_ptr<Config> config;

// we comment the default config values, just like /etc/pacman.conf
inline const std::string defConfig = R"#([general]
# if true(default), then it'll uses git for downloading/updating the aur repo
# else if false, then it'll use tarballs (.tar.gz) of the aur repo
inline const string defConfig = R"#([general]
# All options are commented out with their default values listed.
# If you wish to use different options values, uncomment and update those.
# It's safe to remove any options you want, just remember their default value

# If true(default), then it'll uses git for downloading/updating the aur repo.
# Else if false, then it'll use tarballs (.tar.gz) of the aur repo.
#useGit = true

# If you use sudo or doas
# If you use sudo or doas.
#sudo = "sudo"

# Optional pretty prints, because some terminals don't suport them
# Optional pretty prints, because some terminals don't suport them.
#colors = true

# If false (default), it'll allow you to operate on system packages as well as AUR.
# this option can be overrided by the --aur-only long option or running "-Ra" instead of "-R".
# This option can be overrided by the --aur-only long option or running "-Ra" instead of "-R".
#aurOnly = false

# Useful for knowing more about TabAUR operations.
# Please activate this before reporting bugs on our Github repo, thank you :)
#debug = true

# Where we are gonna download the AUR packages (default $XDG_CACHE_HOME/TabAUR, else ~/.cache/TabAUR)
#cacheDir = "$XDG_CACHE_HOME/TabAUR"

[bins]
#makepkgBin = "makepkg"
#makepkg = "makepkg"
#git = "git"

[pacman]
#RootDir = "/"
#DBPath = "/var/lib/pacman"
#ConfigFile = "/etc/pacman.conf"
#MakepkgConf = "/etc/makepkg.conf"
)#";

[storage]
# Where we are gonna download the AUR packages (default $XDG_CACHE_HOME, else ~/.cache/TabAUR)
#cacheDir = "~/.cache/TabAUR"
inline const string defTheme = R"#([theme]
red = "#ff2000"
green = "#00ff00"
blue = "#00aaff"
cyan = "#00ffff"
yellow = "#ffff00"
magenta = "#ff11cc"
)#";

inline string red = "#ff2000";
inline string green = "#00ff00";
inline string blue = "#00aaff";
inline string cyan = "#00ffff";
inline string yellow = "#ffff00";
inline string magenta = "#ff11cc";

inline string configfile;
inline string themefile;

#endif
Loading
Loading