#!/usr/bin/env python

import sys
import os

from subprocess import call

import platform

def puaq():
    print("Usage: %s contents" % os.path.basename(__file__))
    sys.exit(1)

def sendtoclipboard(contents):
    clipboard_app = "xclip -sel clip" # for linux
    if platform.system() == "Darwin":
        clipboard_app = "pbcopy"
    call("inline_echo.py '%s' | %s" % (contents, clipboard_app), shell=True)

if __name__ == "__main__":

    if len(sys.argv) < 2:
        puaq()

    contents = ""
    for c in sys.argv[1:]:
        contents += c + " "
    contents = contents.strip()

    sendtoclipboard(contents)


@@ -174,16 +174,269 @@
 xit(1)%0A%0A
+def getplat():%0A    ps = platform.system().lower()%0A    if ps == %22linux%22:%0A        return %22linux%22%0A    elif ps == %22windows%22:%0A        return %22windows%22%0A    elif ps == %22cygwin_nt-10.0%22:%0A        return %22cygwin%22%0A    elif ps == %22darwin%22:%0A        return %22macosx%22%0A%0A
 def send
@@ -458,16 +458,90 @@
 tents):%0A
+%0A
+    clipboard_app = %22%22%0A    plat = getplat()%0A%0A    if plat == %22linux%22:%0A    
     clip
@@ -590,36 +590,46 @@
     
+el
 if plat
-form.system()
+ == %22windows%22 or plat
  == %22
-Dar
+cyg
 win%22
@@ -659,15 +659,137 @@
  = %22
-pbcopy%22
+clip%22%0A    elif plat == %22macosx%22:%0A        clipboard_app = %22pbcopy%22%0A    else:%0A        print(%22UNsupported platform%22)%0A        return%0A
 %0A   
@@ -1069,9 +1069,8 @@
 ntents)%0A
-%0A

support for windows clipboard