codekingpro/portable-devtools
114k
1import pyperclip2import sys3 4if len(sys.argv) > 1 and sys.argv[1] in ('-c', '--copy'):5 if len(sys.argv) > 2:6 pyperclip.copy(sys.argv[2])7 else:8 pyperclip.copy(sys.stdin.read())9elif len(sys.argv) > 1 and sys.argv[1] in ('-p', '--paste'):10 sys.stdout.write(pyperclip.paste())11else:12 print('Usage: python -m pyperclip [-c | --copy] [text_to_copy] | [-p | --paste]')13 print()14 print('If a text_to_copy argument is provided, it is copied to the')15 print('clipboard. Otherwise, the stdin stream is copied to the')16 print('clipboard. (If reading this in from the keyboard, press')17 print('CTRL-Z on Windows or CTRL-D on Linux/macOS to stop.')18 print('When pasting, the clipboard will be written to stdout.')