Skip to content
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

Copy function propopsal #16

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion clir/utils/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import uuid
import platform
import subprocess
import pyperclip
from rich import box
from rich.console import Console
from rich.table import Table
Expand Down Expand Up @@ -103,6 +104,11 @@ def run_command(self):
os.system(command)

def copy_command(self):

def to_clippboard(command):
pyperclip.copy(command)


current_commands = self.commands

uid = self.get_command_uid()
Expand All @@ -114,14 +120,19 @@ def copy_command(self):

if uid:
print(f'Copying command: {command}')
if platform.system() == "Darwin":

to_clippboard(command)

'''if platform.system() == "Darwin":
# Verify that pbcopy is installed
if _verify_installation(package = "pbcopy"):
os.system(f'echo -n "{command}" | pbcopy')
else:
print("pbcopy is not installed, this command needs pbcopy to work properly")
return
elif platform.system() == "Linux":


# Verify that xclip is installed
if _verify_installation(package = "xclip"):
os.system(f'echo -n "{command}" | xclip -selection clipboard')
Expand All @@ -130,6 +141,7 @@ def copy_command(self):
return
else:
print("OS not supported")
'''

# Create a function that deletes a command when passing its uid
def remove_command(self):
Expand Down
Loading