Merge pull request #383 from SiddheshKukade/master

Feature Request : Copy to Clipboard form file
This commit is contained in:
Advaita Saha 2022-10-14 22:31:43 +05:30 committed by GitHub
commit 153f7411dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 33 deletions

View File

@ -80,14 +80,21 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Agnish Ghosh</b></sub> <sub><b>Agnish Ghosh</b></sub>
</a> </a>
</td> </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"> <td align="center">
<a href="https://github.com/rahulkarda"> <a href="https://github.com/rahulkarda">
<img src="https://avatars.githubusercontent.com/u/76204863?v=4" width="100;" alt="rahulkarda"/> <img src="https://avatars.githubusercontent.com/u/76204863?v=4" width="100;" alt="rahulkarda"/>
<br /> <br />
<sub><b>Rahul Karda</b></sub> <sub><b>Rahul Karda</b></sub>
</a> </a>
</td></tr> </td>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/muratonuryildirim"> <a href="https://github.com/muratonuryildirim">
<img src="https://avatars.githubusercontent.com/u/77264793?v=4" width="100;" alt="muratonuryildirim"/> <img src="https://avatars.githubusercontent.com/u/77264793?v=4" width="100;" alt="muratonuryildirim"/>
@ -122,6 +129,14 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br /> <br />
<sub><b>Abhishek Kushwaha</b></sub> <sub><b>Abhishek Kushwaha</b></sub>
</a> </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>
<td align="center"> <td align="center">
<a href="https://github.com/yunghog"> <a href="https://github.com/yunghog">
@ -129,8 +144,7 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br /> <br />
<sub><b>YUNGH OG</b></sub> <sub><b>YUNGH OG</b></sub>
</a> </a>
</td></tr> </td>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/Farhan-2222"> <a href="https://github.com/Farhan-2222">
<img src="https://avatars.githubusercontent.com/u/87274221?v=4" width="100;" alt="Farhan-2222"/> <img src="https://avatars.githubusercontent.com/u/87274221?v=4" width="100;" alt="Farhan-2222"/>
@ -152,26 +166,12 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Raihan Khan</b></sub> <sub><b>Raihan Khan</b></sub>
</a> </a>
</td> </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"> <td align="center">
<a href="https://github.com/ArshErgon"> <a href="https://github.com/ArshErgon">
<img src="https://avatars.githubusercontent.com/u/40994679?v=4" width="100;" alt="ArshErgon"/> <img src="https://avatars.githubusercontent.com/u/40994679?v=4" width="100;" alt="ArshErgon"/>
<br /> <br />
<sub><b>Mohd Arsh Ali </b></sub> <sub><b>Mohd Arsh Ali </b></sub>
</a> </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> </td></tr>
<tr> <tr>
<td align="center"> <td align="center">
@ -489,6 +489,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Arijit Ghosh</b></sub> <sub><b>Arijit Ghosh</b></sub>
</a> </a>
</td> </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"> <td align="center">
<a href="https://github.com/Danuragtiwari"> <a href="https://github.com/Danuragtiwari">
<img src="https://avatars.githubusercontent.com/u/86867000?v=4" width="100;" alt="Danuragtiwari"/> <img src="https://avatars.githubusercontent.com/u/86867000?v=4" width="100;" alt="Danuragtiwari"/>
@ -509,15 +516,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br /> <br />
<sub><b>Heshanthaka</b></sub> <sub><b>Heshanthaka</b></sub>
</a> </a>
</td> </td></tr>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/Gokul-Ks"> <a href="https://github.com/Gokul-Ks">
<img src="https://avatars.githubusercontent.com/u/73174047?v=4" width="100;" alt="Gokul-Ks"/> <img src="https://avatars.githubusercontent.com/u/73174047?v=4" width="100;" alt="Gokul-Ks"/>
<br /> <br />
<sub><b>Gokul_Zuzu</b></sub> <sub><b>Gokul_Zuzu</b></sub>
</a> </a>
</td></tr> </td>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/KuSantosh100"> <a href="https://github.com/KuSantosh100">
<img src="https://avatars.githubusercontent.com/u/97560663?v=4" width="100;" alt="KuSantosh100"/> <img src="https://avatars.githubusercontent.com/u/97560663?v=4" width="100;" alt="KuSantosh100"/>
@ -552,15 +559,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br /> <br />
<sub><b>Raj Saha </b></sub> <sub><b>Raj Saha </b></sub>
</a> </a>
</td> </td></tr>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/ramonsaraiva"> <a href="https://github.com/ramonsaraiva">
<img src="https://avatars.githubusercontent.com/u/5559120?v=4" width="100;" alt="ramonsaraiva"/> <img src="https://avatars.githubusercontent.com/u/5559120?v=4" width="100;" alt="ramonsaraiva"/>
<br /> <br />
<sub><b>Ramon Saraiva</b></sub> <sub><b>Ramon Saraiva</b></sub>
</a> </a>
</td></tr> </td>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/riyajaiswal25"> <a href="https://github.com/riyajaiswal25">
<img src="https://avatars.githubusercontent.com/u/84279900?v=4" width="100;" alt="riyajaiswal25"/> <img src="https://avatars.githubusercontent.com/u/84279900?v=4" width="100;" alt="riyajaiswal25"/>
@ -595,15 +602,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br /> <br />
<sub><b>Anjali Chauhan</b></sub> <sub><b>Anjali Chauhan</b></sub>
</a> </a>
</td> </td></tr>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/anshrusia200"> <a href="https://github.com/anshrusia200">
<img src="https://avatars.githubusercontent.com/u/85791796?v=4" width="100;" alt="anshrusia200"/> <img src="https://avatars.githubusercontent.com/u/85791796?v=4" width="100;" alt="anshrusia200"/>
<br /> <br />
<sub><b>Ansh Rusia</b></sub> <sub><b>Ansh Rusia</b></sub>
</a> </a>
</td></tr> </td>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/arpitbhardwaj"> <a href="https://github.com/arpitbhardwaj">
<img src="https://avatars.githubusercontent.com/u/23013825?v=4" width="100;" alt="arpitbhardwaj"/> <img src="https://avatars.githubusercontent.com/u/23013825?v=4" width="100;" alt="arpitbhardwaj"/>
@ -638,15 +645,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br /> <br />
<sub><b>Null</b></sub> <sub><b>Null</b></sub>
</a> </a>
</td> </td></tr>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/yashbrid03"> <a href="https://github.com/yashbrid03">
<img src="https://avatars.githubusercontent.com/u/65955929?v=4" width="100;" alt="yashbrid03"/> <img src="https://avatars.githubusercontent.com/u/65955929?v=4" width="100;" alt="yashbrid03"/>
<br /> <br />
<sub><b>Yash Nilesh Brid</b></sub> <sub><b>Yash Nilesh Brid</b></sub>
</a> </a>
</td></tr> </td>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/mclmza"> <a href="https://github.com/mclmza">
<img src="https://avatars.githubusercontent.com/u/7353871?v=4" width="100;" alt="mclmza"/> <img src="https://avatars.githubusercontent.com/u/7353871?v=4" width="100;" alt="mclmza"/>
@ -681,15 +688,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br /> <br />
<sub><b>Prathamesh Nayak</b></sub> <sub><b>Prathamesh Nayak</b></sub>
</a> </a>
</td> </td></tr>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/smit-sms"> <a href="https://github.com/smit-sms">
<img src="https://avatars.githubusercontent.com/u/52400400?v=4" width="100;" alt="smit-sms"/> <img src="https://avatars.githubusercontent.com/u/52400400?v=4" width="100;" alt="smit-sms"/>
<br /> <br />
<sub><b>Smit Shah</b></sub> <sub><b>Smit Shah</b></sub>
</a> </a>
</td></tr> </td>
<tr>
<td align="center"> <td align="center">
<a href="https://github.com/SameerSahu007"> <a href="https://github.com/SameerSahu007">
<img src="https://avatars.githubusercontent.com/u/29480670?v=4" width="100;" alt="SameerSahu007"/> <img src="https://avatars.githubusercontent.com/u/29480670?v=4" width="100;" alt="SameerSahu007"/>

View File

@ -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>
```

View File

@ -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")