Created
July 7, 2021 20:05
-
-
Save MAGANER/272a8affe4fa07105cbde864756f4d92 to your computer and use it in GitHub Desktop.
i just need to run several terminals in the same directory, so i wrote this script to get current dir and paste it to clipboard, but also it can put whole file to clipboard.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#for Windows | |
import pathlib | |
import sys | |
import os | |
curr_path = pathlib.Path().resolve() | |
def copy2cb(data): | |
with open(".ts","w") as f: | |
f.write(str(data)) | |
os.system("clip < .ts") | |
os.system("erase .ts") | |
if len(sys.argv) == 1: | |
copy2cb(curr_path) | |
elif len(sys.argv) == 2: | |
with open(sys.argv[1],"rb") as f: | |
copy2cb(f.read()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment