# HG changeset patch # User Jeff Hammel # Date 1393179045 28800 # Node ID 5866313756702feb2e2db161a9a236ff9a1f5bff # Parent e6f680d25d63004ea7b415d6893688c55e9d1aa7 STUB: README.txt textshaper/main.py diff -r e6f680d25d63 -r 586631375670 README.txt --- 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 diff -r e6f680d25d63 -r 586631375670 textshaper/main.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)