diff --git a/clir/utils/objects.py b/clir/utils/objects.py index 3b6911c..bbe0829 100644 --- a/clir/utils/objects.py +++ b/clir/utils/objects.py @@ -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 @@ -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() @@ -114,7 +120,10 @@ 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') @@ -122,6 +131,8 @@ def copy_command(self): 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') @@ -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):