-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bashlib: implement new CLI options #929
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,8 @@ ocrd__parse_argv () { | |
fi | ||
|
||
ocrd__argv[overwrite]=false | ||
ocrd__argv[profile]=false | ||
ocrd__argv[profile_file]= | ||
ocrd__argv[mets_file]="$PWD/mets.xml" | ||
|
||
local __parameters=() | ||
|
@@ -127,6 +129,7 @@ ocrd__parse_argv () { | |
-l|--log-level) ocrd__argv[log_level]=$2 ; shift ;; | ||
-h|--help|--usage) ocrd__usage; exit ;; | ||
-J|--dump-json) ocrd__dumpjson; exit ;; | ||
-D|--dump-module-dir) echo $(dirname $OCRD_TOOL_JSON); exit ;; | ||
-C|--show-resource) ocrd__show_resource "$2"; exit ;; | ||
-L|--list-resources) ocrd__list_resources; exit ;; | ||
-p|--parameter) __parameters+=(-p "$2") ; shift ;; | ||
|
@@ -137,6 +140,8 @@ ocrd__parse_argv () { | |
-w|--working-dir) ocrd__argv[working_dir]=$(realpath "$2") ; shift ;; | ||
-m|--mets) ocrd__argv[mets_file]=$(realpath "$2") ; shift ;; | ||
--overwrite) ocrd__argv[overwrite]=true ;; | ||
--profile) ocrd__argv[profile]=true ;; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should elevate this to spec. But having it in core anyway, it's only natural to at least pass the information on in the arg parser for bashlib. Of course there is not so much more we can do from bashlib (except perhaps There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's an amazing snippet I will save for later :)
I agree, so for consistency's sake, shall we change the mechanism in the python implementation to use environment variables ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once we have agreed upon a general mechanism (also for error handling, caching, timeouts and for "universal parameters" like DPI or runtime input/output validation) – yes, then that should be used here, too. At the moment this just restores consistency for the current state of affairs (i.e. the existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get that, but consistency with the current state of affairs is also the target of this PR, so I thought we could handle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Oh, now I got it. But that's a breaking change! And I doubt we will arrive at a definitive conclusion for the general configuration/customization issue quickly. So why not just get this done first?
Ah, I see! Then let's just implement them quick and dirty (see above) as a first step. Also, with a thing like bashlib, you cannot say that they are not implemented: bashlib processors can now start implementing them. (But not without the parser!) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In c7aa0a8 I implemented a variant that's superior to Example with ocrd-olena-binarize…
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this is still just tracing (but again, the processor code can act on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I thought I could slip a backwards-incompatible change into your PR, that's not the right approach. Let's align bashlib and core first and postpone the discussion about configuring these "extra" behaviors. OK, I agree that c7aa0a8 is a sensible approximation of the functionality. Always impressed with your knowledge of bash internals 👍 Funnily enough, @MehmedGIT and I debugged a problem with his ocrd_olena installation with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it will also give us hints which parts of the bashlib processors need to be streamlined or parallelised. And we can just ask the user to provide these logs from their environment now. |
||
--profile-file) ocrd__argv[profile_file]=$(realpath "$2") ; shift ;; | ||
-V|--version) ocrd ocrd-tool "$OCRD_TOOL_JSON" version; exit ;; | ||
*) ocrd__raise "Unknown option '$1'" ;; | ||
esac | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 that's a sensible location because it will normally be the
$SHAREDIR
for installation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and there's nothing we can rely on from bashlib except for the installation path of the tool json (by whatever means the tool got there)