Skip to content

Commit 13f8535

Browse files
committed
docs: migrate all documentation to single 'notes' mode, update CLI usage and structure
1 parent 350ae35 commit 13f8535

4 files changed

Lines changed: 49 additions & 66 deletions

File tree

Docs/DevelopmentGuide/DETAILED_IMPLEMENTATION.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,14 @@ graph TD
123123
```mermaid
124124
graph TD
125125
Root[/Data Directory/] --> Notes[/Notes/]
126-
Root --> Recipes[/Recipes/]
127126
Root --> Versions[/Versions/]
128127
Root --> Logs[/Logs/]
129128
130129
Notes --> N1[note1.txt]
131130
Notes --> N2[note2.txt]
132131
133-
Recipes --> R1[recipe1.txt]
134-
Recipes --> R2[recipe2.txt]
135-
136132
Versions --> V1[note1_20240315_123456.txt]
137-
Versions --> V2[recipe1_20240315_123456.txt]
133+
Versions --> V2[note1_20240315_123456.txt]
138134
139135
Logs --> L1[history.txt]
140136
Logs --> L2[error.log]
@@ -482,13 +478,12 @@ graph TD
482478
command_args_t parse_arguments(int argc, char *argv[]) {
483479
command_args_t args = {
484480
.cmd_type = CMD_INVALID,
485-
.category = NULL,
486481
.filename = NULL,
487482
.valid = false
488483
};
489484

490485
// Validate argument count
491-
if (argc < 4) {
486+
if (argc < 3) {
492487
return args;
493488
}
494489

@@ -499,8 +494,7 @@ command_args_t parse_arguments(int argc, char *argv[]) {
499494
args.cmd_type = CMD_READ;
500495
} // ... other commands
501496

502-
args.category = argv[2];
503-
args.filename = argv[3];
497+
args.filename = argv[2];
504498
args.valid = true;
505499
return args;
506500
}
@@ -530,9 +524,9 @@ bool validate_command(command_args_t *args) {
530524

531525
#### File Creation Example
532526
```c
533-
bool create_document(const char *category, const char *filename) {
527+
bool create_document(const char *filename) {
534528
char filepath[MAX_PATH_LENGTH];
535-
snprintf(filepath, MAX_PATH_LENGTH, "data/%s/%s", category, filename);
529+
snprintf(filepath, MAX_PATH_LENGTH, "data/%s", filename);
536530

537531
// Check if file exists
538532
if (file_exists(filepath)) {
@@ -560,16 +554,16 @@ bool create_document(const char *category, const char *filename) {
560554
561555
#### File Update with Version Control
562556
```c
563-
bool update_document(const char *category, const char *filename) {
557+
bool update_document(const char *filename) {
564558
// Create backup before update
565-
if (!create_version_backup(category, filename)) {
559+
if (!create_version_backup(filename)) {
566560
log_error("Failed to create backup");
567561
return false;
568562
}
569563
570564
// Perform update
571565
char filepath[MAX_PATH_LENGTH];
572-
snprintf(filepath, MAX_PATH_LENGTH, "data/%s/%s", category, filename);
566+
snprintf(filepath, MAX_PATH_LENGTH, "data/%s", filename);
573567
574568
FILE *fp = fopen(filepath, "w");
575569
if (!fp) {
@@ -846,18 +840,17 @@ typedef struct {
846840
```c
847841
void test_create_document(void) {
848842
// Setup
849-
const char *category = "test";
850843
const char *filename = "test_doc.txt";
851844

852845
// Test
853-
bool result = create_document(category, filename);
846+
bool result = create_document(filename);
854847

855848
// Assert
856849
assert(result == true);
857-
assert(file_exists("data/test/test_doc.txt"));
850+
assert(file_exists("data/test_doc.txt"));
858851

859852
// Verify content
860-
char *content = read_document(category, filename);
853+
char *content = read_document(filename);
861854
assert(content != NULL);
862855
assert(strcmp(content, "test content") == 0);
863856

Docs/DevelopmentGuide/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ graph TD
109109
Include --> UtilsH[utils.h]
110110
111111
Data --> Notes[notes/]
112-
Data --> Recipes[recipes/]
113112
Data --> Versions[versions/]
114113
Data --> Logs[logs/]
115114
@@ -133,7 +132,7 @@ graph TD
133132
mkdir -p src include data bin obj tests
134133

135134
# Create data subdirectories
136-
mkdir -p data/{notes,recipes,versions,logs}
135+
mkdir -p data/{notes,versions,logs}
137136
```
138137

139138
3. **Create Initial Files**
@@ -200,8 +199,7 @@ typedef enum {
200199
// Command arguments structure
201200
typedef struct {
202201
command_type_t cmd_type;
203-
char *category;
204-
char *filename;
202+
char filename[256];
205203
bool valid;
206204
} command_args_t;
207205

@@ -221,10 +219,10 @@ b. **file_ops.h** - File Operations
221219
#include <stdbool.h>
222220

223221
// File operation functions
224-
bool create_document(const char *category, const char *filename);
225-
bool read_document(const char *category, const char *filename);
226-
bool update_document(const char *category, const char *filename);
227-
bool delete_document(const char *category, const char *filename);
222+
bool create_document(const char *filename);
223+
bool read_document(const char *filename);
224+
bool update_document(const char *filename);
225+
bool delete_document(const char *filename);
228226

229227
#endif // FILE_OPS_H
230228
```

Docs/design_rationale.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ src/
3333
```c
3434
typedef struct {
3535
command_type_t cmd_type;
36-
char category[64];
3736
char filename[256];
3837
bool valid;
3938
} command_args_t;
@@ -54,10 +53,9 @@ typedef struct {
5453

5554
```
5655
data/
57-
├── recipes/ # Category-based organization
58-
├── notes/
59-
├── logs/ # Operation history
60-
└── versions/ # Backup storage
56+
├── notes/ # Note documents
57+
├── logs/ # Operation history
58+
└── versions/ # Backup storage
6159
```
6260

6361
**Advantages:**
@@ -155,8 +153,8 @@ Input → Validation → Operation → Logging → Result
155153
```c
156154
// On update, before modifying file:
157155
snprintf(version_path, sizeof(version_path),
158-
"%s/%s_%s_%s",
159-
VERSIONS_DIR, category, timestamp, filename);
156+
"%s/notes_%s_%s",
157+
VERSIONS_DIR, timestamp, filename);
160158
```
161159

162160
**Benefits:**

documentation.md

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ HOD Signature: [HOD Name]
3838
Department Seal
3939

4040
## Abstract
41-
NoteCLI is a command-line based notepad application written in C that provides users with a robust and efficient way to manage text documents. The system implements CRUD (Create, Read, Update, Delete) operations with additional features like automatic versioning and comprehensive operation logging. The application emphasizes data organization through categories, ensuring systematic document management while maintaining version history and operation tracking.
41+
NoteCLI is a command-line based notepad application written in C that provides users with a robust and efficient way to manage text documents. The system implements CRUD (Create, Read, Update, Delete) operations with additional features like automatic versioning and comprehensive operation logging. The application emphasizes data organization through a dedicated notes directory, ensuring systematic document management while maintaining version history and operation tracking.
4242

4343
## Table of Contents
4444
1. [Introduction](#introduction)
@@ -58,7 +58,7 @@ NoteCLI is a command-line based notepad application written in C that provides u
5858

5959
## 1. Introduction
6060
NoteCLI is a modern solution for text document management through command-line interface. The application provides a seamless experience for users who prefer terminal-based operations, offering robust features like:
61-
- Category-based document organization
61+
- Dedicated notes directory for document organization
6262
- Automatic version control
6363
- Comprehensive operation logging
6464
- Error handling and validation
@@ -77,7 +77,7 @@ NoteCLI addresses these limitations by providing a structured approach to docume
7777
## 3. Objectives
7878
1. Develop a command-line based notepad application
7979
2. Implement CRUD operations for text documents
80-
3. Create a category-based file organization system
80+
3. Organize all documents in a single notes directory
8181
4. Integrate automatic version control
8282
5. Implement comprehensive operation logging
8383
6. Ensure robust error handling and validation
@@ -260,14 +260,13 @@ graph TD
260260
```
261261
NoteCLI/
262262
├── bin/ # Compiled binary
263-
├── src/ # Source code files
264-
├── include/ # Header files
265-
├── data/ # Document storage
266-
│ ├── recipes/ # Recipe documents
267-
│ ├── notes/ # Note documents
268-
│ ├── logs/ # Operation logs
269-
│ └── versions/ # Version backups
270-
└── obj/ # Object files
263+
├── src/ # Source code files
264+
├── include/ # Header files
265+
├── data/ # Document storage
266+
│ ├── notes/ # Note documents
267+
│ ├── logs/ # Operation logs
268+
│ └── versions/ # Version backups
269+
└── obj/ # Object files
271270
```
272271

273272
#### Operation Procedure
@@ -279,17 +278,17 @@ make # Build new executable
279278

280279
2. Running Commands
281280
```bash
282-
# Create document
283-
./bin/NotesCLI create <category> <filename>
281+
# Create note
282+
./bin/NotesCLI create <filename>
284283

285-
# Read document
286-
./bin/NotesCLI read <category> <filename>
284+
# Read note
285+
./bin/NotesCLI read <filename>
287286

288-
# Update document
289-
./bin/NotesCLI update <category> <filename>
287+
# Update note
288+
./bin/NotesCLI update <filename>
290289

291-
# Delete document
292-
./bin/NotesCLI delete <category> <filename>
290+
# Delete note
291+
./bin/NotesCLI delete <filename>
293292
```
294293

295294
## 9. Testing
@@ -347,24 +346,24 @@ make clean && make
347346

348347
2. Create a note:
349348
```bash
350-
./bin/NotesCLI create notes todo.txt
349+
./bin/NotesCLI create todo.txt
351350
# Enter content and press Ctrl+D
352351
```
353352

354353
3. Read the note:
355354
```bash
356-
./bin/NotesCLI read notes todo.txt
355+
./bin/NotesCLI read todo.txt
357356
```
358357

359358
4. Update the note:
360359
```bash
361-
./bin/NotesCLI update notes todo.txt
360+
./bin/NotesCLI update todo.txt
362361
# Enter new content and press Ctrl+D
363362
```
364363

365364
5. Delete the note:
366365
```bash
367-
./bin/NotesCLI delete notes todo.txt
366+
./bin/NotesCLI delete todo.txt
368367
```
369368

370369
## 11. Future Enhancements
@@ -406,18 +405,13 @@ The NoteCLI project demonstrates the effectiveness of command-line based documen
406405
## 14. Annex
407406
### A. Command Reference
408407
```bash
409-
NotesCLI <command> <category> <filename>
408+
NotesCLI <command> <filename>
410409

411410
Commands:
412-
create - Create a new document
413-
read - Read an existing document
414-
update - Update an existing document
415-
delete - Delete an existing document
416-
417-
Categories:
418-
recipes - For storing recipes
419-
notes - For general notes
420-
logs - For logs and records
411+
create - Create a new note
412+
read - Read an existing note
413+
update - Update an existing note
414+
delete - Delete an existing note
421415
```
422416

423417
### B. Error Codes

0 commit comments

Comments
 (0)