Skip to content

Feature Request : Copy to Clipboard form file #383

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

Merged
merged 10 commits into from
Oct 14, 2022
73 changes: 40 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,21 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Agnish Ghosh</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SiddheshKukade">
<img src="https://avatars.githubusercontent.com/u/65951872?v=4" width="100;" alt="SiddheshKukade"/>
<br />
<sub><b>Siddhesh Bhupendra Kuakde</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/rahulkarda">
<img src="https://avatars.githubusercontent.com/u/76204863?v=4" width="100;" alt="rahulkarda"/>
<br />
<sub><b>Rahul Karda</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/muratonuryildirim">
<img src="https://avatars.githubusercontent.com/u/77264793?v=4" width="100;" alt="muratonuryildirim"/>
Expand Down Expand Up @@ -122,15 +129,22 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Abhishek Kushwaha</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Khushi260">
<img src="https://avatars.githubusercontent.com/u/94845508?v=4" width="100;" alt="Khushi260"/>
<br />
<sub><b>Khushi Jha</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/yunghog">
<img src="https://avatars.githubusercontent.com/u/41548444?v=4" width="100;" alt="yunghog"/>
<br />
<sub><b>YUNGH OG</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/Farhan-2222">
<img src="https://avatars.githubusercontent.com/u/87274221?v=4" width="100;" alt="Farhan-2222"/>
Expand All @@ -152,26 +166,12 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Raihan Khan</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/SiddheshKukade">
<img src="https://avatars.githubusercontent.com/u/65951872?v=4" width="100;" alt="SiddheshKukade"/>
<br />
<sub><b>Siddhesh Bhupendra Kuakde</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/ArshErgon">
<img src="https://avatars.githubusercontent.com/u/40994679?v=4" width="100;" alt="ArshErgon"/>
<br />
<sub><b>Mohd Arsh Ali </b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Khushi260">
<img src="https://avatars.githubusercontent.com/u/94845508?v=4" width="100;" alt="Khushi260"/>
<br />
<sub><b>Khushi Jha</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
Expand Down Expand Up @@ -489,6 +489,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Arijit Ghosh</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Yaswanth820">
<img src="https://avatars.githubusercontent.com/u/55750562?v=4" width="100;" alt="Yaswanth820"/>
<br />
<sub><b>Balaji Yaswanth Vankala</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Danuragtiwari">
<img src="https://avatars.githubusercontent.com/u/86867000?v=4" width="100;" alt="Danuragtiwari"/>
Expand All @@ -509,15 +516,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Heshanthaka</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Gokul-Ks">
<img src="https://avatars.githubusercontent.com/u/73174047?v=4" width="100;" alt="Gokul-Ks"/>
<br />
<sub><b>Gokul_Zuzu</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/KuSantosh100">
<img src="https://avatars.githubusercontent.com/u/97560663?v=4" width="100;" alt="KuSantosh100"/>
Expand Down Expand Up @@ -552,15 +559,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Raj Saha </b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/ramonsaraiva">
<img src="https://avatars.githubusercontent.com/u/5559120?v=4" width="100;" alt="ramonsaraiva"/>
<br />
<sub><b>Ramon Saraiva</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/riyajaiswal25">
<img src="https://avatars.githubusercontent.com/u/84279900?v=4" width="100;" alt="riyajaiswal25"/>
Expand Down Expand Up @@ -595,15 +602,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Anjali Chauhan</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/anshrusia200">
<img src="https://avatars.githubusercontent.com/u/85791796?v=4" width="100;" alt="anshrusia200"/>
<br />
<sub><b>Ansh Rusia</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/arpitbhardwaj">
<img src="https://avatars.githubusercontent.com/u/23013825?v=4" width="100;" alt="arpitbhardwaj"/>
Expand Down Expand Up @@ -638,15 +645,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Null</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/yashbrid03">
<img src="https://avatars.githubusercontent.com/u/65955929?v=4" width="100;" alt="yashbrid03"/>
<br />
<sub><b>Yash Nilesh Brid</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/mclmza">
<img src="https://avatars.githubusercontent.com/u/7353871?v=4" width="100;" alt="mclmza"/>
Expand Down Expand Up @@ -681,15 +688,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Prathamesh Nayak</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/smit-sms">
<img src="https://avatars.githubusercontent.com/u/52400400?v=4" width="100;" alt="smit-sms"/>
<br />
<sub><b>Smit Shah</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/SameerSahu007">
<img src="https://avatars.githubusercontent.com/u/29480670?v=4" width="100;" alt="SameerSahu007"/>
Expand Down
6 changes: 6 additions & 0 deletions scripts/Copy to clipboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copy to Clipboard
A tool that will help you to copy the contents of a file having any size without opening that file
## Usage/Examples
```sh
$ clipboard.py <fileName>
```
29 changes: 29 additions & 0 deletions scripts/Copy to clipboard/clipboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os
import sys
import platform
import subprocess

# Seeing if the file exists
if os.path.exists(sys.argv[1]):
# Open Only if the file exists on the computer
f = open(sys.argv[1], "r")
# Storing the Content of the file in the f_contents variable
f_contents = f.read()
# closing the opened file
f.close()
else:
# If the file Doesn't Exists
print("File Not found : copy2clip <file_name>")
exit(1)
# Storing the current OS version
whatos = platform.system()
# If Darwin or Ubuntu
if whatos == "Darwin":
subprocess.run("pbcopy", universal_newlines=True, input=f_contents)
print("success: copied to clipboard")
# If Windows
elif whatos == "Windows":
subprocess.run("clip", universal_newlines=True, input=f_contents)
print("success: copied to clipboard")
else:
print("failed: clipboard not supported")