mirror of
https://github.com/tomasriveral/NoteWrapper.git
synced 2026-08-12 02:18:38 +02:00
miscellanious stuff
This commit is contained in:
@@ -112,7 +112,7 @@ Change `~/.config/notewrapper/config.json`. If it does not exist, the program sh
|
|||||||
- [x] Add flags for customization
|
- [x] Add flags for customization
|
||||||
- [ ] Write a good README.md
|
- [ ] Write a good README.md
|
||||||
- [x] Option to not render and to only open nvim
|
- [x] Option to not render and to only open nvim
|
||||||
- [ ] Figure out this vivify issue https://github.com/jannis-baum/Vivify/issues/291
|
- [x] Figure out this vivify issue https://github.com/jannis-baum/Vivify/issues/291
|
||||||
- [ ] Port this to other editors
|
- [ ] Port this to other editors
|
||||||
- [x] Port to vim
|
- [x] Port to vim
|
||||||
- [ ] Fixe all the small stuff marked //(TODO LATER) in the code
|
- [ ] Fixe all the small stuff marked //(TODO LATER) in the code
|
||||||
|
|||||||
+1
-1
@@ -432,7 +432,7 @@ next_arg:
|
|||||||
}
|
}
|
||||||
|
|
||||||
qsort(vaultsArray, vaultsCount, sizeof(const char *), compareString); // sorts the vaults alphabetically
|
qsort(vaultsArray, vaultsCount, sizeof(const char *), compareString); // sorts the vaults alphabetically
|
||||||
debug("Available vaults");
|
debug("┌--------------------------------\nAvailable vaults:");
|
||||||
if (shouldDebug) {
|
if (shouldDebug) {
|
||||||
for (int i = 0; i < vaultsCount; i++) {
|
for (int i = 0; i < vaultsCount; i++) {
|
||||||
altDebug("%s\n", vaultsArray[i]);
|
altDebug("%s\n", vaultsArray[i]);
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@ char **getVaultsFromDirectory(char *dirString, int *count, int shouldDebug) {
|
|||||||
// (TODO LATER) it might be a good idea to check if these directories exist
|
// (TODO LATER) it might be a good idea to check if these directories exist
|
||||||
// (TODO LATER) expand ~ as it does not work with opendir()
|
// (TODO LATER) expand ~ as it does not work with opendir()
|
||||||
// this function is inputed a path to a directory (which comes usually from the config file) and outpus all the suitable directories (so not the hidden ones) which will serve as separate vaults for notes
|
// this function is inputed a path to a directory (which comes usually from the config file) and outpus all the suitable directories (so not the hidden ones) which will serve as separate vaults for notes
|
||||||
debug("Opening %s", dirString);
|
debug("Opening %s ", dirString);
|
||||||
// originally from https://www.geeksforgeeks.org/c/c-program-list-files-sub-directories-directory/
|
// originally from https://www.geeksforgeeks.org/c/c-program-list-files-sub-directories-directory/
|
||||||
struct dirent *vaultsDirectoryEntry;
|
struct dirent *vaultsDirectoryEntry;
|
||||||
DIR *vaultsDirectory = opendir(dirString);
|
DIR *vaultsDirectory = opendir(dirString);
|
||||||
|
|||||||
+6
-2
@@ -25,18 +25,22 @@ void getCurrentTime(int *hour, int *minute, int *second) {
|
|||||||
|
|
||||||
void _debug(const int d, const char *file, const int line, const char *function, const char *message, ...) { // use for formatted debug
|
void _debug(const int d, const char *file, const int line, const char *function, const char *message, ...) { // use for formatted debug
|
||||||
if (d) {
|
if (d) {
|
||||||
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
va_list args; //variadic function stuff
|
va_list args; //variadic function stuff
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
int h, m, s;
|
int h, m, s;
|
||||||
getCurrentTime(&h, &m, &s);
|
getCurrentTime(&h, &m, &s);
|
||||||
fprintf(stderr, "\e[0;32m[DEBUG -- %d:%d:%d] From file %s line %d function %s:\e[0m\n", h, m, s, file, line, function);
|
fprintf(stderr, "\e[0;32m[DEBUG -- %d:%d:%d] From file %s line %d function %s:\e[0m\n", h, m, s, file, line, function);
|
||||||
vfprintf(stderr, message, args);
|
vfprintf(stderr, message, args);
|
||||||
printf("\e[0m\n");
|
fprintf(stderr, "\e[0m\n");
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void _altDebug(const int d, const char *message, ...) { // use for less formal debuggin. (usefull if enumerating or making a list
|
void _altDebug(const int d, const char *message, ...) { // use for less formal debuggin. (usefull if enumerating or making a list
|
||||||
if (d) {
|
if (d) {
|
||||||
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
vfprintf(stderr, message, args);
|
vfprintf(stderr, message, args);
|
||||||
@@ -204,7 +208,7 @@ int doesEditorExist (char *editorToCheck, int shouldDebug) { // Some exectua
|
|||||||
}
|
}
|
||||||
char *path_env = getenv("PATH");
|
char *path_env = getenv("PATH");
|
||||||
error(!path_env, "program", "getenv(\"PATH\") failed to get your path. NoteWrapper is unable to check if your desired editor is installed\n");
|
error(!path_env, "program", "getenv(\"PATH\") failed to get your path. NoteWrapper is unable to check if your desired editor is installed\n");
|
||||||
debug("Your PATH is %s", path_env);
|
debug("Your PATH is %s\n", path_env);
|
||||||
char *paths = strdup(path_env); // duplicate because strtok modifies the string
|
char *paths = strdup(path_env); // duplicate because strtok modifies the string
|
||||||
char *dir = strtok(paths, ":");
|
char *dir = strtok(paths, ":");
|
||||||
while (dir) {
|
while (dir) {
|
||||||
|
|||||||
Reference in New Issue
Block a user