Compare commits
52 Commits
6862af407e
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9414db11e1
|
||
|
|
6513a73ce4
|
||
|
|
5d32c49557
|
||
|
|
1e1d6b9115
|
||
|
|
ec8d491e6f
|
||
|
|
278b11f1c1
|
||
|
|
677bd89362 | ||
|
|
537f57a3b2 | ||
|
|
49c403cf63 | ||
|
|
31831d29d7 | ||
|
|
e35ba14b19 | ||
|
|
1c1ab9d29b | ||
|
|
8a114acc71 | ||
|
|
aa25ef9a6a | ||
|
|
6ec4aebf2a | ||
|
|
481d853ebc | ||
|
|
895abb1f0b | ||
|
|
0ef406e59c | ||
|
|
3e02cfe363 | ||
|
|
05adbf5d33 | ||
|
|
705f989737 | ||
|
|
90991e7401 | ||
|
|
694a71362d | ||
|
|
60f5e2af3e | ||
|
|
ec9a455a49 | ||
|
|
40f2155a34 | ||
|
|
668dd69ac0 | ||
|
|
758300b704 | ||
|
|
b73e47e590 | ||
|
|
c5ba5e8bfa | ||
|
|
0e709a08e2 | ||
|
|
1914119412 | ||
|
|
2dd52012a7 | ||
|
|
4c1d6a3f79 | ||
|
|
691045186f | ||
|
|
87d220912e | ||
|
|
4049d732bb | ||
|
|
0efd48dd6f | ||
|
|
5fbf6bed11 | ||
|
|
8a649463c5 | ||
|
|
aa3502dc7b | ||
|
|
44a7c3aacc | ||
|
|
f0aa6758dc | ||
|
|
13ebbcd049 | ||
|
|
1a45b1e219 | ||
|
|
aa851fad3a | ||
|
|
a89a330ede | ||
|
|
38ca5234ca | ||
|
|
a4319c5b38 | ||
|
|
f152a85d8a | ||
|
|
dd7c5d0a1c | ||
|
|
9e0ff21192 |
74
.github/workflows/build.yml
vendored
Normal file
74
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
name: Build Todd
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
|
with:
|
||||||
|
packages: libncurses5-dev
|
||||||
|
version: "1.0"
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- name: copy to build folder
|
||||||
|
run: |
|
||||||
|
mkdir -p build
|
||||||
|
cp ./todd build/
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: todd-linux
|
||||||
|
path: build
|
||||||
|
|
||||||
|
build-mac:
|
||||||
|
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- name: copy to build folder
|
||||||
|
run: |
|
||||||
|
mkdir -p build
|
||||||
|
cp ./todd build/
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: todd-mac
|
||||||
|
path: build
|
||||||
|
|
||||||
|
build-windows:
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: msys2 {0}
|
||||||
|
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: msys2/setup-msys2@v2
|
||||||
|
with:
|
||||||
|
msystem: mingw64
|
||||||
|
update: true
|
||||||
|
install: >-
|
||||||
|
gcc
|
||||||
|
make
|
||||||
|
ncurses-devel
|
||||||
|
- name: make
|
||||||
|
run: make
|
||||||
|
- name: copy to build folder
|
||||||
|
run: |
|
||||||
|
mkdir -p build
|
||||||
|
cp ./todd.exe build/
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: todd-windows
|
||||||
|
path: build
|
||||||
6
Makefile
6
Makefile
@@ -1,7 +1,7 @@
|
|||||||
.DEFAULT_GOAL := all
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-Wall -Wextra -Werror -pedantic -std=c99 -O3
|
CFLAGS=-Wall -Wextra -Werror -pedantic -std=c99 -g
|
||||||
|
|
||||||
todo.o:
|
todo.o:
|
||||||
$(CC) $(CFLAGS) -c engine/todo.c -o todo.o
|
$(CC) $(CFLAGS) -c engine/todo.c -o todo.o
|
||||||
@@ -12,6 +12,7 @@ main.o:
|
|||||||
clean:
|
clean:
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
rm -f todd
|
rm -f todd
|
||||||
|
rm /usr/local/bin/todd || true
|
||||||
|
|
||||||
todd: todo.o main.o
|
todd: todo.o main.o
|
||||||
$(CC) $(CFLAGS) todo.o main.o -lncurses -o todd
|
$(CC) $(CFLAGS) todo.o main.o -lncurses -o todd
|
||||||
@@ -20,6 +21,3 @@ all: todd
|
|||||||
|
|
||||||
install: todd
|
install: todd
|
||||||
cp todd /usr/local/bin/todd
|
cp todd /usr/local/bin/todd
|
||||||
|
|
||||||
uninstall:
|
|
||||||
rm /usr/local/bin/todd || true
|
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
- ncurses development libraries
|
- ncurses development libraries
|
||||||
## Building
|
## Building
|
||||||
To build `todd` all you need to do is run `make`.
|
To build `todd` all you need to do is run `make`.
|
||||||
## Usage
|
|
||||||
```sh
|
|
||||||
./todd <file.todd>
|
|
||||||
```
|
|
||||||
## 3rd Party
|
## 3rd Party
|
||||||
Todd uses the following dependencies:
|
Todd uses the following dependencies:
|
||||||
- stb_ds - https://github.com/nothings/stb
|
- stb_ds - https://github.com/nothings/stb
|
||||||
|
|||||||
15
color.h
15
color.h
@@ -1,15 +0,0 @@
|
|||||||
#ifndef COLOR_H
|
|
||||||
#define COLOR_H
|
|
||||||
|
|
||||||
#include <ncurses.h>
|
|
||||||
|
|
||||||
#define BORDERS_PRIMARY COLOR_BLACK
|
|
||||||
#define BORDERS_SECONDARY COLOR_WHITE
|
|
||||||
|
|
||||||
#define DEFAULT_PRIMARY COLOR_WHITE
|
|
||||||
#define DEFAULT_SECONDARY COLOR_BLACK
|
|
||||||
|
|
||||||
#define COMPLETED_PRIMARY COLOR_BLACK
|
|
||||||
#define COMPLETED_SECONDARY COLOR_YELLOW
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "todo.h"
|
#include "todo.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// Memory management
|
// Memory management
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#define TODO_H
|
#define TODO_H
|
||||||
#define TODO_MAX_TITLE_LENGTH 255
|
#define TODO_MAX_TITLE_LENGTH 255
|
||||||
|
|
||||||
|
#define true 1
|
||||||
|
#define false 0
|
||||||
typedef unsigned char bool_t;
|
typedef unsigned char bool_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
23
main.c
23
main.c
@@ -1,9 +1,9 @@
|
|||||||
#include "engine/todo.h"
|
#include "engine/todo.h"
|
||||||
#include "color.h"
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ncurses.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
@@ -59,9 +59,9 @@ void initialize_curses(int *width, int *height) {
|
|||||||
*height = th;
|
*height = th;
|
||||||
|
|
||||||
start_color();
|
start_color();
|
||||||
init_pair(BORDERS_PAIR, BORDERS_PRIMARY, BORDERS_SECONDARY);
|
init_pair(BORDERS_PAIR, COLOR_BLACK, COLOR_WHITE);
|
||||||
init_pair(DEFAULT_PAIR, DEFAULT_PRIMARY, DEFAULT_SECONDARY);
|
init_pair(DEFAULT_PAIR, COLOR_WHITE, COLOR_BLACK);
|
||||||
init_pair(COMPLETED_PAIR, COMPLETED_PRIMARY, COMPLETED_SECONDARY);
|
init_pair(COMPLETED_PAIR, COLOR_BLACK, COLOR_GREEN);
|
||||||
// turn off echoing of keys, and enter cbreak mode,
|
// turn off echoing of keys, and enter cbreak mode,
|
||||||
// where no buffering is performed on keyboard input
|
// where no buffering is performed on keyboard input
|
||||||
cbreak();
|
cbreak();
|
||||||
@@ -235,22 +235,12 @@ void add_command_handler(int width, int height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void view_command_handler(int width, int height, int index) {
|
void view_command_handler(int width, int height, int index) {
|
||||||
// check if the index is out of bounds
|
|
||||||
if (index < 0 || index >= arrlen(todos)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TodoItem item = todos[index];
|
TodoItem item = todos[index];
|
||||||
// create an alert in the middle of the screen
|
// create an alert in the middle of the screen
|
||||||
alert(item.title, width, height);
|
alert(item.title, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mark_command_handler(int index) {
|
void mark_command_handler(int index) {
|
||||||
// check if the index is out of bounds
|
|
||||||
if (index < 0 || index >= arrlen(todos)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TodoItem item = todos[index];
|
TodoItem item = todos[index];
|
||||||
|
|
||||||
todo_mark_item(&item, !item.completed);
|
todo_mark_item(&item, !item.completed);
|
||||||
@@ -262,11 +252,6 @@ void mark_command_handler(int index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void remove_command_handler(int index) {
|
void remove_command_handler(int index) {
|
||||||
// check if the index is out of bounds
|
|
||||||
if (index < 0 || index >= arrlen(todos)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
arrdel(todos, index);
|
arrdel(todos, index);
|
||||||
|
|
||||||
// set the dirty flag
|
// set the dirty flag
|
||||||
|
|||||||
Reference in New Issue
Block a user