changeset 22:586631375670

STUB: README.txt textshaper/main.py
author Jeff Hammel <k0scist@gmail.com>
date Sun, 23 Feb 2014 10:10:45 -0800
parents e6f680d25d63
children 7ffe000f6f42
files README.txt textshaper/main.py
diffstat 2 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/README.txt	Sun Feb 23 00:45:06 2014 -0800
+++ b/README.txt	Sun Feb 23 10:10:45 2014 -0800
@@ -31,6 +31,16 @@
 * things that alter spacing
 
 
+== Things to import from my fluxbox keys ==
+
+From http://k0s.org/hg/config/file/tip/.fluxbox/keys ::
+
+  Control Mod1 o :ExecCommand xclip -o | /home/jhammel/python/onelineit.py | xclip -i # put the clipboard contents on one line
+  Control Mod1 p :ExecCommand xclip -o | /home/jhammel/python/pbmoz.py | xclip -i # pastebin
+  Control Mod1 q :ExecCommand xclip -o | /home/jhammel/python/quote.py | xclip -i # quote using >'s
+  Control Mod1 0 :ExecCommand xclip -o | sed 's/^[-+]//' | xclip -i # strip leading +s
+
+
 == Reference ==
 
 Highly related (~> identity): http://k0s.org/portfolio/ideas/cleanuptext.py
--- a/textshaper/main.py	Sun Feb 23 00:45:06 2014 -0800
+++ b/textshaper/main.py	Sun Feb 23 10:10:45 2014 -0800
@@ -34,25 +34,26 @@
 def add_options(parser):
     """add options to the parser instance"""
 
-    parser.add_option('-f', '--file',  dest='input',
-                      type=argparse.FileType('r'), default=sys.stdin,
-                      help="file to read from [DEFAULT: stdin]")
+    parser.add_argument('-f', '--file',  dest='input',
+                        type=argparse.FileType('r'), default=sys.stdin,
+                        help="file to read from [DEFAULT: stdin]")
 
     if which('xclip'): # TODO: support e.g. xsel or python native
-        parser.add_option('-c', '--clip', '--copy', dest='copy_to_clipboard',
-                          action='store_true', default=False,
-                          help="copy to clipboard")
+        parser.add_argument('-c', '--clip', '--copy', dest='copy_to_clipboard',
+                            action='store_true', default=False,
+                            help="copy to clipboard")
 
 
 
 def main(args=sys.argv[1:]):
 
     # parse command line options
-    parser = argparse.ArgumentParser(description=__doc__, formatter=PlainDescriptionFormatter())
+    parser = argparse.ArgumentParser(description=__doc__)
+    add_options(parser)
     options = parser.parse_args(args)
 
-    # read from stdin
-    content = options.read()
+    # read input
+    content = options.input.read()
 
     # print formatted content
     display(content)