cnotes/README.md
2026-01-30 13:39:48 +00:00

204 lines
4.3 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
### cnfind
Search notes by text, category, or date.
```bash
cnfind meeting # search for 'meeting' in text (case-insensitive)
cnfind -c Work # show all entries in Work category
cnfind -d 2025-01-30 # show all entries from a specific date
cnfind -c Work meeting # search 'meeting' in Work category only
cnfind -i meeting # case-sensitive search
cnfind -n meeting # show only match count
```
Options:
- `-c CATEGORY` - Filter by category (case-insensitive)
- `-d DATE` - Filter by date (YYYY-MM-DD)
- `-i` - Case-sensitive search (default is case-insensitive)
- `-n` - Show only count of matches
The output includes line numbers for use with `cndel -n`.
## 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:
- [ ] **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