jss icon indicating copy to clipboard operation
jss copied to clipboard

port to argparse, support reading from stdin

Open ryan-williams opened this issue 10 years ago • 12 comments

fixes #1, #8

ryan-williams avatar Jan 24 '15 19:01 ryan-williams

Nice! Can you check that this doesn't break the tests (now that I added the .spec files)?

danvk avatar Jan 24 '15 19:01 danvk

thanks, will do

ryan-williams avatar Jan 24 '15 19:01 ryan-williams

cool. I killed the . no-operator, which seemed not useful or no longer useful. lmk if i missed something of significance there

ryan-williams avatar Jan 24 '15 19:01 ryan-williams

The . no-op selectors was based on jq, where it's mandatory. I believe the issue is that jss foo is ambiguous: do you want to apply the selector foo to stdin, or do you want to apply no selectors to the file foo. How does this change handle that situation?

danvk avatar Jan 24 '15 20:01 danvk

gotcha, i'll add it back in

ryan-williams avatar Jan 24 '15 20:01 ryan-williams

FYI, the test failed because of some issue relating to pandoc. That dependency isn't needed for testing, so you might be able to fix it with something like:

pip install -r <(grep -v pandoc requirements.txt)

danvk avatar Jan 24 '15 20:01 danvk

would be helpful to have a test for stdin input, too

danvk avatar Jan 24 '15 20:01 danvk

nm about the test, I fixed it on master, you should just be able to rebase.

danvk avatar Jan 24 '15 20:01 danvk

ok, going back to .-semantics, what if the decision tree is:

  • only 1 arg total (and no -k or -v) --> it must be a selector and input must come from stdin
  • if there is a -k or -v, then there should be zero "unparsed" args (read from stdin) xor one "unparsed" arg (filename).

?

ryan-williams avatar Jan 24 '15 20:01 ryan-williams

That sounds reasonable. What would you do with this?

jss .foo .bar .baz

is that something that's accepted now? Where does it fall in your decision tree? Is it illegal?

danvk avatar Jan 25 '15 17:01 danvk

Hey Ryan -- want to get this merged in? I don't think there are any fundamental issues.

danvk avatar Feb 25 '15 17:02 danvk

sure, I'll take a pass on this as soon as I get my spark post out

On Wed Feb 25 2015 at 12:35:02 PM Dan Vanderkam [email protected] wrote:

Hey Ryan -- want to get this merged in? I don't think there are any fundamental issues.

— Reply to this email directly or view it on GitHub https://github.com/danvk/jss/pull/7#issuecomment-76012976.

ryan-williams avatar Feb 25 '15 18:02 ryan-williams