Skip to content

Commit 03d9f93

Browse files
committed
Added the feature
1 parent 3d037fe commit 03d9f93

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/arguments/save.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ def generate_file_name(self, directory):
2727
while filename in file_list:
2828
filename = str(uuid.uuid4()).replace("-", "_")[:4]
2929

30-
return filename
30+
return filename
31+
32+
def __repr__(self):
33+
return str(self.save_results_filename)

src/arguments/search.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from .error import SearchError
88
from .utility import Utility
9+
from .save import SaveSearchResults
910

1011

1112
class Prompt():
@@ -27,7 +28,8 @@ def __init__(self, arguments):
2728
def search_args(self):
2829
if self.arguments.search:
2930
self.search_for_results()
30-
31+
elif self.arguments.file:
32+
self.search_for_results(True)
3133
elif self.arguments.new:
3234
url = "https://stackoverflow.com/questions/ask"
3335
if type(self.arguments.new) == str:
@@ -61,4 +63,7 @@ def search_for_results(self, save=False):
6163
data = self.utility_object.get_ans(questions)
6264

6365
if save:
64-
SaveSearchResults(data)
66+
filename = SaveSearchResults(data)
67+
print(
68+
colored(f"Answers successfully saved into {filename}", "green")
69+
)

0 commit comments

Comments
 (0)