question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

allow passing param json via stdin in CLI

See original GitHub issue

Sometimes it is preferable to specify parameters for processing on the fly. But the CLI module expects a filesystem path. It could be easily extended to allow - for stdin as well, by adding allow_dash=True to ocrd_tool_tool_parse_params, which is available since Click 6.0. This would enable on-the-fly specifications using here strings, e.g.:

ocrd-tesserocr-recognize -m mets.xml -p - <<<'{ "textequiv_level": "glyph", "model": "Fraktur" }'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
kbacommented, Jun 18, 2019

How about:

  • Is it a readable filename?
    • yes: read it, parse it, continue
    • no: Does the string start with { (whitespace allowed)
      • yes: parse it
        • success: parse it, continue
        • failure: raise json parse exception
      • no: raise file not found exception
0reactions
mikegerbercommented, Jun 21, 2019

Looks good @kba 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pass JSON as command line argument to Node - Stack Overflow
I wanted to pass around lots of options via JSON between parts of my program (a master node routine calling a bunch of...
Read more >
Pass JSON to script via stdin instead of as an argument #79
This calls the tee command which reads from stdin and outputs everything to its stdout. So it essentially writes 'testing! to the stdin...
Read more >
Loading AWS CLI parameters from a file
For commands that take binary data as a parameter, specify that the data is binary content by using the fileb:// prefix. Commands that...
Read more >
Ubuntu - How do I pass JSON string to herestring?
I have a command where I need to pass a JSON string to the options but for some reasons I need it to...
Read more >
Using the CLI - Oracle Help Center
This topic describes how to use the CLI to access Oracle Cloud Infrastructure and carry out service-related tasks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found