diff --git a/application.py b/application.py index d322794..c48d367 100755 --- a/application.py +++ b/application.py @@ -1062,6 +1062,7 @@ if __name__ == "__main__": parser.set_defaults(mode=None) parser.set_defaults(cipher='none') parser.set_defaults(linetype='unix') + parser.set_defaults(pipe=False) parser.set_defaults(binary=False) parser.set_defaults(cmds=[]) @@ -1070,6 +1071,8 @@ if __name__ == "__main__": parser.add_option('-b', '--binary', dest='binary', action='store_true', help='open file(s) in hex binary mode') + parser.add_option('-p', '--pipe', dest='pipe', action='store_true', + help='read data from STDIN into buffer') parser.add_option('-d', '--debug', dest='debug', action='store_true', help='run in debug mode') parser.add_option('-e', '--encrypt', dest='cipher', metavar='CIPHER', @@ -1107,6 +1110,14 @@ if __name__ == "__main__": names = set() paths = set() + # if we used a pipe to read some data, that will be our first buffer + if opts.pipe: + raise Exception("--pipe doesn't work yet") + data = sys.stdin.read() + b = buffer.data.DataBuffer('*Pipe*', data) + b.open() + buffers.append(b) + for path in args: path = os.path.abspath(os.path.realpath(util.expand_tilde(path))) if path in paths: