You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all this tool is great for work under shell, thanks for your great job!
While for most of people, we often need to get the past query history for review. Could you add such as feature that collection the history input and output to a text file? And hopefully this is configurable but not inputting the filename every time.
Just for your reference and thanks.
The text was updated successfully, but these errors were encountered:
Hey, I'm doing just what you said by wrapping my calls to trans in another script, which in turn calls the original trans program, allowing me to save what I've used as inputs and the output to a separate file.
Here's an example using Python
# trans.pyimportsubprocessimportsys# switch the first argument (the .py filename)# with a call to the actual `trans` executableargs= ["trans"] +sys.argv[1:]
result=subprocess.run(
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True
)
# print the output as expectedprint(result.stdout)
# save input and output to a filewithopen("logs.txt", "a") asfile:
file.write(str(args) +"\n\n")
file.write(result.stdout)
file.write("\n\n=========================\n")
you can then call python3 trans.py instead of trans, ex.
python3 trans_wrap.py fr: "je suis français"
python3 trans_wrap.py pt-br:en "e é assim que fica o script" -speak
and the output would be saved to "logs.txt"
cat logs.txt
['trans', 'fr:', 'je suis français']
je suis français
I am French
Translations of je suis français
[ Français -> English ]
je suis français
I am French, I'm French
=========================
['trans', 'pt-br:en', 'e é assim que fica o script', '-speak']
e é assim que fica o script
and this is how the script looks
Translations of e é assim que fica o script
[ -> English ]
e é assim que fica o script
, and this is how the script looks like
=========================
First of all this tool is great for work under shell, thanks for your great job!
While for most of people, we often need to get the past query history for review. Could you add such as feature that collection the history input and output to a text file? And hopefully this is configurable but not inputting the filename every time.
Just for your reference and thanks.
The text was updated successfully, but these errors were encountered: