-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding file.temp_file to eldritch #797
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops sorry @adm1nPanda i should have been more clear in the issue description.
For this feature we'd like to leverage the OSes default tmp system.
/tmp/
on linux, /var/private/tmp/*/*/*
on mac, C:\Users\AppData\Local\Temp
(i think) on Windows. You shouldn't need to specify the tmp dir path the library should handle that for you.
To do this we can leverage the temp file library we've been using and it looks like the .keep()
call you're making is exactly what we need.
Instead of a random file name in a specified dir i'd like to create a tmp file in and optionally specify the name of that file.
The file should be empty and the function should return the path to the newly created file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Just a couple changes then should be good 🤌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarified how to do optional parameters.
This way lets users do something like:
tmp_file = file.temp()
# - or -
name_tmp_file = file.temp("special_name.txt")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple nits that you can ignore if you want.
One small change please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Some optional nits if you want but this looks good to me! 🙂
What type of PR is this?
/feature
/kind eldritch-function
What this PR does / why we need it:
Implemented file.temp_file()
Which issue(s) this PR fixes:
Fixes #788