aboutsummaryrefslogtreecommitdiff
path: root/search.py
diff options
context:
space:
mode:
authorChristian Cleberg <hello@cleberg.net>2025-06-04 13:32:08 -0500
committerChristian Cleberg <hello@cleberg.net>2025-06-04 13:32:08 -0500
commitd4166e03980177c3395fddac85977645ee2a4294 (patch)
treeae9f1d3ddd33b0122606ace471ec6b0fccf860f9 /search.py
parent2c8b05646b4fc2b14c7f026a8bfe08c757498a3c (diff)
downloadcrumb-d4166e03980177c3395fddac85977645ee2a4294.tar.gz
crumb-d4166e03980177c3395fddac85977645ee2a4294.tar.bz2
crumb-d4166e03980177c3395fddac85977645ee2a4294.zip
feat: format python files
Diffstat (limited to 'search.py')
-rw-r--r--search.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/search.py b/search.py
index 098e392..ad81184 100644
--- a/search.py
+++ b/search.py
@@ -1,15 +1,24 @@
-import sys
import os
+import sys
LOG_PATH = os.path.expanduser("~/.crumb/history.org")
def search_log(query):
+ """
+ Search for a given query string within the crumb history log file and print matching entries.
+
+ Args:
+ query (str): The search term to look for in the history entries.
+
+ Returns:
+ None
+ """
if not os.path.exists(LOG_PATH):
print("No history file found.")
return
with open(LOG_PATH, "r") as f:
- entries = f.read().split("* ")[1:] # split on org-mode headings
+ entries = f.read().split("* ")[1:]
found = 0
for entry in entries:
@@ -21,7 +30,11 @@ def search_log(query):
print("No matches found.")
if __name__ == "__main__":
+ """
+ Entry point for the script. Parses command line arguments and calls the search function.
+ Usage: search_crumb.py <search term>
+ """
if len(sys.argv) < 2:
print("Usage: search_crumb.py <search term>")
else:
- search_log(sys.argv[1]) \ No newline at end of file
+ search_log(sys.argv[1])