190 lines
3.8 KiB
Markdown
190 lines
3.8 KiB
Markdown
# cnotes
|
|
|
|
A simple command-line note-taking system written in strict C89/ANSI C for maximum portability.
|
|
|
|
## Overview
|
|
|
|
cnotes provides quick, one-line note capture from the terminal. Notes are stored in a simple CSV format and can be displayed, sorted, and filtered.
|
|
|
|
## Supported Platforms
|
|
|
|
- Linux/Unix (GCC)
|
|
- macOS (GCC/Clang)
|
|
- Windows (Turbo C++ 3.0, MinGW)
|
|
- DOS 6.22 (Turbo C++ 3.0)
|
|
|
|
## Building
|
|
|
|
### Linux/Unix/macOS
|
|
|
|
```bash
|
|
make
|
|
```
|
|
|
|
Binaries are placed in the `build/` directory.
|
|
|
|
### DOS/Windows (Turbo C++ 3.0)
|
|
|
|
```batch
|
|
make -f MAKEFILE.TC
|
|
```
|
|
|
|
Or use the batch file if `make` is unavailable:
|
|
|
|
```batch
|
|
BUILD.BAT
|
|
```
|
|
|
|
### Installation (Unix-like systems)
|
|
|
|
```bash
|
|
sudo make install # installs to /usr/local/bin
|
|
sudo make uninstall # removes from /usr/local/bin
|
|
```
|
|
|
|
## Commands
|
|
|
|
### cnadd
|
|
|
|
Add a new timestamped note entry.
|
|
|
|
```bash
|
|
cnadd "Remember to call Bob"
|
|
cnadd -c Work "Meeting at 3pm"
|
|
cnadd -c Personal "Buy groceries"
|
|
```
|
|
|
|
Options:
|
|
- `-c CATEGORY` - Specify category (max 10 chars, default: "General")
|
|
|
|
### cndump
|
|
|
|
Display all notes in a formatted table.
|
|
|
|
```bash
|
|
cndump # display all notes
|
|
cndump -d # sort by date (newest first)
|
|
cndump -c # sort by category
|
|
cndump -r # reverse sort order
|
|
cndump -d -r # sort by date, oldest first
|
|
```
|
|
|
|
Options:
|
|
- `-d, --date` - Sort by date/time
|
|
- `-c, --category` - Sort by category
|
|
- `-r, --reverse` - Reverse sort order
|
|
|
|
### cncount
|
|
|
|
Display note statistics.
|
|
|
|
```bash
|
|
cncount # total entry count
|
|
cncount -c # count by category
|
|
cncount -d # count by date
|
|
```
|
|
|
|
Options:
|
|
- `-c, --category` - Show counts per category
|
|
- `-d, --date` - Show counts per date
|
|
|
|
### cndel
|
|
|
|
Delete note entries.
|
|
|
|
```bash
|
|
cndel -n 5 # delete entry at line 5
|
|
cndel -l # delete the last (most recent) entry
|
|
cndel -d 2025-01-30 # delete all entries from a specific date
|
|
cndel -n 5 -y # delete without confirmation prompt
|
|
```
|
|
|
|
Options:
|
|
- `-n LINE_NUMBER` - Delete entry at specified line number
|
|
- `-d DATE` - Delete all entries matching DATE (YYYY-MM-DD)
|
|
- `-l` - Delete the last (most recent) entry
|
|
- `-y` - Skip confirmation prompt
|
|
|
|
## Configuration
|
|
|
|
### Notes Location
|
|
|
|
By default, notes are stored in:
|
|
|
|
| Platform | Location |
|
|
|----------|----------|
|
|
| Unix/Linux | `~/.local/share/cnotes/cnotes.csv` |
|
|
| Windows | `%USERPROFILE%\.cnotes\cnotes.csv` |
|
|
| DOS | Current directory or `%CNOTES_HOME%\cnotes.csv` |
|
|
|
|
### Environment Variables
|
|
|
|
- `CNOTES_PATH` - Override the notes directory location (highest priority)
|
|
- On DOS, set `CNOTES_HOME` if `HOME` is not available
|
|
|
|
Example:
|
|
```bash
|
|
export CNOTES_PATH=/custom/path/to/notes
|
|
```
|
|
|
|
### Compile-time Configuration
|
|
|
|
Override defaults by defining at compile time:
|
|
|
|
```bash
|
|
gcc -DCNOTES_DIR=\".mynotes\" -DMAX_ENTRIES=1000 ...
|
|
```
|
|
|
|
## Data Format
|
|
|
|
Notes are stored in CSV format:
|
|
|
|
```
|
|
DATE,TIME,CATEGORY ,"MESSAGE"
|
|
2025-01-30,14:30,Work ,"Meeting with team"
|
|
2025-01-30,09:15,Personal ,"Buy groceries"
|
|
```
|
|
|
|
Fields:
|
|
- Date: `YYYY-MM-DD` (10 chars)
|
|
- Time: `HH:MM` (5 chars)
|
|
- Category: padded to 10 chars
|
|
- Message: quoted, max 125 chars
|
|
|
|
## TODO
|
|
|
|
Future commands to implement:
|
|
|
|
- [ ] **cnfind** - Search notes by keyword, category, or date
|
|
```
|
|
cnfind "meeting" # search in message text
|
|
cnfind -c Work # filter by category
|
|
cnfind -d 2025-01-30 # filter by date
|
|
```
|
|
|
|
- [ ] **cntail** - Show last N entries (quick view)
|
|
```
|
|
cntail # last 5 entries
|
|
cntail -n 10 # last 10 entries
|
|
```
|
|
|
|
- [ ] **cncat** - List unique categories
|
|
```
|
|
cncat # list categories
|
|
cncat -c # with counts
|
|
```
|
|
|
|
- [ ] **cnexport** - Export to other formats
|
|
```
|
|
cnexport > notes.txt # plain text
|
|
cnexport -t > notes.tsv # tab-separated
|
|
```
|
|
|
|
## License
|
|
|
|
[Your license here]
|
|
|
|
## Author
|
|
|
|
Gregory Gauthier
|