Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Commit

Permalink
implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
hirusha-adi committed Jan 23, 2024
1 parent 8c9e858 commit db09575
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion search.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
import argparse
import os
from docx_search import docx_search

docx_search()
def main():
parser = argparse.ArgumentParser(description='Search for a word in .docx files in a specified directory.')
parser.add_argument(
'--dir', dest='target_dir', type=str, default=os.getcwd(),
help='The target directory to search for .docx files. Defaults to the current working directory.'
)
parser.add_argument('--word', dest='target_word', type=str,
help='The word to search for in the documents. If not provided, user will be prompted.')
args = parser.parse_args()

target_dir = args.target_dir
target_word = args.target_word

if not target_word:
target_word = input("Enter the word to search for: ")

docx_search(target_dir=target_dir, target_word=target_word)

if __name__ == "__main__":
main()

0 comments on commit db09575

Please sign in to comment.