zenlc2000 / pyp3

Pyed Piper tool by Toby Rosen at Sony Imageworks converted to Python 3
34 stars 13 forks source link

--dummy-input ~~is not implemented~~ should read --blank_inputs #4

Closed bobpaul closed 7 years ago

bobpaul commented 7 years ago

While it's not documented in the "manpage" from pyp -m, --dummy-input is mentioned in the pyp -h help text:

  -n, --no_input        use with command that generates output with no input;
                        same as --dummy_input 1

Some might see this as is a simple documentation bug, but I think --dummy_input could be rather useful for debugging. pyp supports file and "secondary" input, but only to supplement what comes in on STDIN. If one wants to read 10 lines from a file, then one needs to also send 10 lines in on STDIN. Using -n provides 1 dummy line and allows one to read 1 line from a file. Implementing --dummy-input n would allow reading n lines from a file without reading in any lines from STDIN.

Mostly I'm interested in this because reading content from STDIN conflicts with pdb. When I'm working with python, I tend to toss a lot of import pdb; pdb.set_trace() statements about, especially when I'm learning a new codebase and getting a feel for how it works. But if I'm piping data into pyp, I can't access the pdb prompt when it appears. And then I make this face ☹️