File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,12 @@ def main():
2828 help = 'Debug script. Will print your token to console! Use with care!'
2929 )
3030
31+ parser .add_argument (
32+ '-q' , '--quiet' ,
33+ action = 'store_true' ,
34+ help = 'Don\' t show errors. Debug overrides this'
35+ )
36+
3137 # TODO argument to change gemini model. For now only use gemma-3-27b-it since it has the most "free" uses per day
3238 # TODO verbose argument, tho idk if needed for such simple script
3339 # TODO "update" argument, which would download new version and install it in place of
@@ -43,6 +49,9 @@ def main():
4349 # Parse the arguments
4450 args = parser .parse_args ()
4551
52+ if args .debug :
53+ args .quiet = False
54+
4655 # Call the main functionality
4756 run_tool (args )
4857
@@ -139,7 +148,13 @@ def run_tool(args):
139148 gemini_output = j ["candidates" ][0 ]["content" ]["parts" ][0 ]["text" ]
140149 print (gemini_output )
141150
142- # TODO no matter the "--keep" argument, save last prompt and response to $TMPDIR/gemini-last.txt
151+ tmp_directory = os .getenv ("TMPDIR" , default = "/tmp" )
152+ if not os .access (tmp_directory , os .W_OK ):
153+ if not args .quiet :
154+ print (f"ERROR: Can't write to { tmp_directory } . No write permissions." )
155+ else :
156+ with open (f"{ tmp_directory } /gemini_last" , "w" ) as file :
157+ file .write ("Prompt: " + prompt + "\n \n " + gemini_output )
143158
144159 if args .keep :
145160 content_location = ("~/.gemini_logs/LOG_"
You can’t perform that action at this time.
0 commit comments