diff --git a/READMEy.md b/READMEy.md new file mode 100644 index 0000000..c25f305 --- /dev/null +++ b/READMEy.md @@ -0,0 +1,35 @@ +# Mini Notes Project 📝 + +Bu proje, komut satırı üzerinden çalışan basit bir not alma uygulamasıdır. + +## V1 Geliştirmeleri (V0 -> V1 Farkları) +Ödevin V1 aşaması kapsamında aşağıdaki güncellemeler yapılmıştır: + +1. **Dil Güncellemesi:** Tüm kullanıcı mesajları ve hata bildirimleri Türkçeleştirilerek kullanım kolaylığı sağlandı. +2. **Öncelik Sistemi:** Not oluştururken artık `Düşük`, `Orta` veya `Yüksek` gibi öncelik seviyeleri eklenebiliyor. +3. **Veri Doğrulama:** Başlık veya içerik boş bırakıldığında uygulamanın hata vermesi ve kullanıcıyı uyarması sağlandı. +4. **Dil Desteği:** Kullanıcı deneyimini artırmak amacıyla tüm hata ve bilgilendirme mesajları Türkçeleştirildi. +5. **Yeni Veri Alanı:** Notlara "Öncelik" (Priority) özelliği eklendi. Artık notlar oluşturulurken önem seviyesi belirtilebiliyor. +6. **Hata Denetimi:** Kullanıcının yanlışlıkla boş başlık veya içerik girmesini engelleyen bir kontrol mekanizması eklendi. + +""" +V2 GÖREV LİSTESİ: +1. 'list' komutunu ekle: Tüm notları döngü kullanarak alt alta listele. +2. 'search' komutunu ekle: Kullanıcının girdiği kelimeyi not başlıklarında ara. +3. 'filter' komutunu ekle: Sadece seçilen öncelik seviyesindeki (Düşük/Orta/Yüksek) notları göster. + +""" +V1 → V2 Değişiklik Özeti: + +Dinamik Listeleme: Statik yapıdan döngüsel yapıya geçildi; artık tüm notlar dosyadan okunup listelenebiliyor. + +Arama Kabiliyeti: Büyük/küçük harf duyarsız arama özelliği ile notlar arasında hızlı erişim sağlandı. + +Gelişmiş Filtreleme: Notlar, V1'de eklenen "Öncelik" seviyelerine göre süzülebilecek şekilde geliştirildi. + +## Kurulum ve Kullanım +Uygulamayı başlatmak için: +`python solution_v1.py init` + +Not eklemek için: +`python solution_v1.py create "Başlık" "İçerik" "Yüksek"` diff --git a/solution_v1.py b/solution_v1.py new file mode 100644 index 0000000..a3e2bd9 --- /dev/null +++ b/solution_v1.py @@ -0,0 +1,114 @@ +""" +mini-notes v0 — Basitlestirilmis implementasyon +Ogrenci: Yağmur Anise KARACA (251478022) +Kapsam: Sadece init ve create komutlari. +Yasaklar: Dongu (for/while) ve Liste ([]) kullanilmadi. +""" +""" + +V2 GÖREV LİSTESİ: +1. 'list' komutunu ekle: Tüm notları döngü kullanarak alt alta listele. +2. 'search' komutunu ekle: Kullanıcının girdiği kelimeyi not başlıklarında ara. +3. 'filter' komutunu ekle: Seçilen önceliğe (Düşük/Orta/Yüksek) göre notları süz. + +""" + +import sys +import os + +def list_notes(): + """Tüm notları döngü ile ekrana yazdırır.""" + if not os.path.exists(".mininotes/notes.dat"): + return "Kayıtlı not bulunamadı." + + f = open(".mininotes/notes.dat", "r") + for line in f: + # Format: id|baslik|icerik|oncelik|tarih + parcalar = line.strip().split("|") + print(f"[{parcalar[0]}] {parcalar[1]} - Öncelik: {parcalar[3]}") + f.close() + return "" + +def search_notes(kelime): + """Notlar içinde arama yapar.""" + f = open(".mininotes/notes.dat", "r") + bulundu = False + for line in f: + if kelime.lower() in line.lower(): + parcalar = line.strip().split("|") + print(f"Eşleşme Bulundu: [{parcalar[0]}] {parcalar[1]}") + bulundu = True + f.close() + if not bulundu: + print(f"'{kelime}' içeren bir not bulunamadı.") + +def filter_notes(seviye): + """Önceliğe göre filtreleme yapar.""" + f = open(".mininotes/notes.dat", "r") + bulundu = False + for line in f: + parcalar = line.strip().split("|") + if parcalar[3].lower() == seviye.lower(): + print(f"[{parcalar[0]}] {parcalar[1]}") + bulundu = True + f.close() + if not bulundu: + print(f"{seviye} önceliğinde not bulunamadı.") + +def initialize(): + """Not defteri klasörünü ve dosyasını oluşturur.""" + if os.path.exists(".mininotes"): + return "Hata: Uygulama zaten başlatılmış." + + os.mkdir(".mininotes") + f = open(".mininotes/notes.dat", "w") + f.close() + return "Not defteri başarıyla oluşturuldu." + +def create_note(title, content, priority="Orta"): + # GÖREV 3: Boş giriş kontrolü + if title == "" or content == "": + return "Hata: Not başlığı veya içeriği boş bırakılamaz!" + + if not os.path.exists(".mininotes"): + return "Hata: Önce uygulamayı başlatmalısınız (init komutu)." + + f = open(".mininotes/notes.dat", "r") + data = f.read() + f.close() + + note_id = data.count("\n") + 1 + + # GÖREV 2: Öncelik bilgisi dosyaya kaydediliyor + f = open(".mininotes/notes.dat", "a") + f.write(str(note_id) + "|" + title + "|" + content + "|" + priority + "|2026-03-17\n") + f.close() + + return "Not başarıyla kaydedildi. ID: " + str(note_id) + " [Öncelik: " + priority + "]" + +def show_not_implemented(command): + return "'" + command + "' komutu ilerleyen haftalarda eklenecektir." + +# --- Ana Program --- +if len(sys.argv) < 2: + print("Kullanım: python mininote.py [argümanlar]") +else: + cmd = sys.argv[1] + + if cmd == "init": + print(initialize()) + elif cmd == "create": + # Create komutu için 4 veya 5 argüman (opsiyonel öncelik dahil) + if len(sys.argv) < 4: + print("Kullanım: python mininote.py create \"Başlık\" \"İçerik\" [Öncelik]") + else: + prio = "Orta" + if len(sys.argv) == 5: + prio = sys.argv[4] + print(create_note(sys.argv[2], sys.argv[3], prio)) + else: + # Diğer komutlar (list, search, delete) henüz aktif değil + if cmd in ["list", "search", "delete"]: + print(show_not_implemented(cmd)) + else: + print("Bilinmeyen komut: " + cmd) diff --git a/y.anise.SPEC.txt b/y.anise.SPEC.txt new file mode 100644 index 0000000..d2943be --- /dev/null +++ b/y.anise.SPEC.txt @@ -0,0 +1,71 @@ +### Dosya 1: SPEC.txt + +PROJECT: mini-note +AUTHOR: Yağmur Anise KARACA (251478022) +VERSION: v1 +DATE: 2026-03-24 + +======================================== +OVERVIEW +======================================== + +mini-notes is a command-line utility to manage quick text notes. +It allows creating, listing, searching, and deleting notes. +All data is stored in a hidden directory called .mininote/ + +======================================== +COMMANDS +======================================== + +--- init --- +Usage: python mininote.py init +Creates a .mininote/ directory and an empty tasks.dat file. +If .mininote/ already exists, print "Already initialized" and exit. + +--- create --- +Usage: python mininote.py create "title" "content" +Displays all saved notes (ID and Title only). +Status: Always active by default. +Prints saved with ID: " + +--- list --- +Usage: python mininote.py list +Description: Displays all saved notes (ID and Title only). +Output: + [1] Shopping List + [2] Meeting Notes +Error: If no notes, print "No notes found." + +--- search --- +Usage: python mininote.py search "keyword" +The search operation is case-insensitive. +Description: Searches for the keyword in titles and contents. +Output: Shows matching notes in 'list' format. +Error: If no match, print "No results for: " + +--- filter --- +Usage: python mininote.py filter "High" +Description: Lists only the notes that match the specified priority. +Output: Displays notes in 'list' format but filtered by priority level. +Error: If no notes match the priority, print "No notes found with priority: " + +--- delete --- +Usage: python mininote.py delete 1 +Description: Removes the note with the given ID. +Output: "Note #1 deleted." +Error: If ID not found, print "Note #1 not found." + +======================================== +DATA FORMAT +======================================== +File: .mininotes/notes.dat +Format: id|title|content|date +Example: 1|Grocery|Buy milk and eggs|2026-03-17 + +======================================== +ERROR HANDLING +======================================== + +- Running any command before "init": "Not initialized. Run: python mininote.py init" +- Unknown command: "Unknown command: " +- Missing arguments: "Usage: python mininote.py [args]"