mirror of
https://github.com/tomasriveral/NoteWrapper.git
synced 2026-08-12 02:18:38 +02:00
Miscellanious todo
This commit is contained in:
+4
-7
@@ -245,8 +245,6 @@ arg_next:
|
|||||||
//---------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// flags and arguments overwrite the config
|
// flags and arguments overwrite the config
|
||||||
// (TODO LATER) maybe add a way to combine flags (such which rm -fr?)
|
|
||||||
// (TODO LATER) add a version flag
|
|
||||||
debug("Parsing the attribute flags.\n This flags might overwrite the options in the config file.");
|
debug("Parsing the attribute flags.\n This flags might overwrite the options in the config file.");
|
||||||
// thoses bypasses are used if some specific flags are passed as args. This allows to bypass the TUI selectors
|
// thoses bypasses are used if some specific flags are passed as args. This allows to bypass the TUI selectors
|
||||||
int bypassSelectionVault = 0;
|
int bypassSelectionVault = 0;
|
||||||
@@ -310,7 +308,7 @@ for (int i = 1; i < argc; i++) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
} else if (strcmp(arg, "--version") == 0) {
|
} else if (strcmp(arg, "--version") == 0) {
|
||||||
printf("No released version yet...\n");
|
printf("NoteWrapper version 1.0\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -499,7 +497,6 @@ note_selection:
|
|||||||
}
|
}
|
||||||
filesCount = filesCount + journalCount;
|
filesCount = filesCount + journalCount;
|
||||||
|
|
||||||
// we sort them // (TODO LATER) THis doesn't seem to sort them
|
|
||||||
qsort(filesArray, filesCount, sizeof(const char *), compareString);
|
qsort(filesArray, filesCount, sizeof(const char *), compareString);
|
||||||
debug("Available notes and journals:");
|
debug("Available notes and journals:");
|
||||||
if (shouldDebug) {
|
if (shouldDebug) {
|
||||||
@@ -540,8 +537,8 @@ note_selection:
|
|||||||
if (strcmp(noteSelected, "Create new note") != 0 && strcmp(noteSelected,"Back to vault selection") != 0 && strcmp(noteSelected, "Delete vault") != 0 && strcmp(noteSelected,"Quit (Ctrl+C)") != 0) {
|
if (strcmp(noteSelected, "Create new note") != 0 && strcmp(noteSelected,"Back to vault selection") != 0 && strcmp(noteSelected, "Delete vault") != 0 && strcmp(noteSelected,"Quit (Ctrl+C)") != 0) {
|
||||||
open_note:
|
open_note:
|
||||||
bypassSelectionNote = 0; // we must reset bypassSelectionNote to avoid getting into an infinite loop of bypassing the note selection
|
bypassSelectionNote = 0; // we must reset bypassSelectionNote to avoid getting into an infinite loop of bypassing the note selection
|
||||||
char *fullPath = malloc(PATH_MAX); // (TODO LATER) Find a more appropriate and descriptive name for the variable
|
char *fullPath = malloc(PATH_MAX);
|
||||||
sprintf(fullPath, "%s/%s/%s", notesDirectoryString, vaultSelected, noteSelected); // (TODO LATER) change all sprintf to snprintf which checks for buffer size
|
snprintf(fullPath, PATH_MAX, "%s/%s/%s", notesDirectoryString, vaultSelected, noteSelected);
|
||||||
// if it is a journal we must update it before
|
// if it is a journal we must update it before
|
||||||
regex_t regex;
|
regex_t regex;
|
||||||
int regexReturn = regcomp(®ex, journalRegex, 0);
|
int regexReturn = regcomp(®ex, journalRegex, 0);
|
||||||
@@ -570,7 +567,7 @@ note_creation:
|
|||||||
if (strcmp(answer, "Yes.") == 0) {
|
if (strcmp(answer, "Yes.") == 0) {
|
||||||
// delete the vault after confirmation by the user
|
// delete the vault after confirmation by the user
|
||||||
char pathToRMRF[PATH_MAX];
|
char pathToRMRF[PATH_MAX];
|
||||||
sprintf(pathToRMRF, "%s/%s", notesDirectoryString, vaultSelected);
|
snprintf(pathToRMRF, PATH_MAX, "%s/%s", notesDirectoryString, vaultSelected);
|
||||||
debug("Removed the directory: %s", pathToRMRF);
|
debug("Removed the directory: %s", pathToRMRF);
|
||||||
rmrf(pathToRMRF, shouldDebug);
|
rmrf(pathToRMRF, shouldDebug);
|
||||||
shouldChangeVault = 1;
|
shouldChangeVault = 1;
|
||||||
|
|||||||
@@ -129,8 +129,6 @@ char **getVaultsFromDirectory(char *dirString, int *count, int shouldDebug) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *updateJournal(char *path, char *journal, char *timeFormat, int shouldDebug) {
|
char *updateJournal(char *path, char *journal, char *timeFormat, int shouldDebug) {
|
||||||
//(TODO LATER) Per journal format configuration
|
|
||||||
// (TODO LATER) with all the usage of PATH_MAX we should really calculate max inputed path or something like this
|
|
||||||
path[PATH_MAX] = '\0'; // it assures it is a string (Most cases this does nothing). But rewriting at least one bytes make the compile happy. He doesn't want to return an unchanged input.
|
path[PATH_MAX] = '\0'; // it assures it is a string (Most cases this does nothing). But rewriting at least one bytes make the compile happy. He doesn't want to return an unchanged input.
|
||||||
debug("Handling the journal %s", path);
|
debug("Handling the journal %s", path);
|
||||||
|
|
||||||
@@ -233,7 +231,6 @@ char *updateJournal(char *path, char *journal, char *timeFormat, int shouldDebug
|
|||||||
strncpy(path, temp, PATH_MAX);
|
strncpy(path, temp, PATH_MAX);
|
||||||
debug("Returning path to the selected entry: %s", path);
|
debug("Returning path to the selected entry: %s", path);
|
||||||
}
|
}
|
||||||
// (TODO LATER) free all unused entryArray[i]
|
|
||||||
} else {
|
} else {
|
||||||
error(1, "program", "%s is not a file and not a directory.", path);
|
error(1, "program", "%s is not a file and not a directory.", path);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user