Sample CLI
gway clip purge
References
Full Code
def purge(*, history=False):
"""Clears clipboard and optionally wipes history file."""
import pyperclip
import os
pyperclip.copy("") # Clear clipboard
gw.info("Clipboard contents purged.")
if history:
history_path = gw.resource('work', 'clip', 'history.txt')
if os.path.exists(history_path):
with open(history_path, 'w', encoding='utf-8') as f:
f.write('')
gw.info("Clipboard history purged.")