We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0f9b7f commit 7826c48Copy full SHA for 7826c48
Copy2Clip/Copy2Clip.py
@@ -0,0 +1,25 @@
1
+import os
2
+import sys
3
+import platform
4
+import subprocess
5
+
6
+# Seeing if the file exists
7
+if os.path.exists(sys.argv[1]):
8
+ f = open(sys.argv[1], "r")
9
+ f_contents = f.read()
10
+ f.close()
11
+else:
12
+ print("Usage: copy2clip <file_name>")
13
+ exit(1)
14
15
+whatos = platform.system()
16
17
+if whatos == "Darwin":
18
+ subprocess.run("pbcopy", universal_newlines=True, input=f_contents)
19
+ print("success: copied to clipboard")
20
+elif whatos == "Windows":
21
+ subprocess.run("clip", universal_newlines=True, input=f_contents)
22
23
24
+ print("failed: clipboard not supported")
25
0 commit comments