TODO: Write set_color_of_date function

This commit is contained in:
xavi 2024-10-05 22:56:11 -07:00
parent 077c9d2828
commit 53fca552b8
2 changed files with 6 additions and 1 deletions

View File

@ -344,7 +344,6 @@ int bind_sql_insert_stmt(filtered_tasks* task, sqlite3_stmt* out_stmt){
}
// TODO: I think instead of string we should make it a date and then make a string here
if ( task->due_date ){
param_pos = 2;
rc = sqlite3_bind_text(out_stmt, param_pos, task->due_date, -1, SQLITE_STATIC);
@ -525,6 +524,7 @@ int print_fixed_width(const unsigned char* str, int width){
}else{
printf("%-*.*s", width, width, "");
}
printf("%s", X_RST);
}
// Print Heading
@ -589,8 +589,11 @@ int display_task_list(int start_col, sqlite3 *db, filtered_tasks* task){
else if ( x_strcmp(col_name, "active_id") == 0 ){
fixed_width = FIXED_ID_WIDTH;
}
// TODO: Add colors to due date
else if ( x_strcmp(col_name, "due_date") == 0 ){
fixed_width = FIXED_DATE_WIDTH;
set_color_of_date(col_val);
printf("%s", X_GREEN);
}
print_fixed_width(col_val, fixed_width);
}

View File

@ -5,6 +5,8 @@
#define X_BOLD "\x1B[1m"
#define X_UNDL "\x1B[21m"
#define X_CYN "\x1B[36m"
#define X_GREEN "\x1B[32m"
#define X_RED "\x1B[31m"
#define X_goup(y) printf("\x1B[%dF", y)
#define X_godown(y) printf("\x1B[%dE", y)
#define X_goupnocr(y) printf("\x1B[%dA", y)