Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@bertsky
Copy link
Collaborator

@bertsky bertsky commented Mar 29, 2023

fixes #1027

@bertsky
Copy link
Collaborator Author

bertsky commented Mar 29, 2023

Note: usage is as follows:

  • the builtin function ocrd__input_file is still available (and I kept the name – no plural), but if there are 2 input fileGrps, then all its result will be a (single-quote delimited) list, e.g. [url]='file1.xml file2.xml' [ID]='id_file1 id_file2' ...
  • whenever it needs to be called, one should therefore encapsulate its results in a (non-associative) array variable and without extra quotes, e.g. in_file=($(ocrd__input_file 3 url))
  • this will yield the first fileGrp's results on index 0, which in bash will always be the same as if you referenced the array without index (so code does not need to be changed much), e.g. test -f $in_file
  • if there is a second fileGrp, then its result will have to be fetched from index 1, e.g. test -f ${in_file[1]}

For a full example, see https://github.com/UB-Mannheim/ocrd_pagetopdf/pull/22

@bertsky
Copy link
Collaborator Author

bertsky commented Mar 30, 2023

For a full example, see UB-Mannheim/ocrd_pagetopdf#22

Since I will probably rewrite ocrd-pagetopdf to not use multiple input fileGrps anymore, we could use another example for this capability.

How about some generic bashlib processor in tests which merely does a cp from input to output? (Or for multiple input fileGrps cp the file from the last grp, respectively.)

Copy link
Member

@kba kba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good way to ensure backwards-compatibility and support multiple input file groups, even if they're not necessary for ocrd_pagetopdf anymore.

@kba
Copy link
Member

kba commented Mar 30, 2023

Note: usage is as follows:

Can you add this as a comment to ocrd__input_file pls?

- explain outputFileId
- explain ocrd__argv and params
- explain main loop pattern
- explain multi-valued input fileGrp
@bertsky
Copy link
Collaborator Author

bertsky commented Mar 30, 2023

Can you add this as a comment to ocrd__input_file pls?

bertsky@2b51a5e

@bertsky bertsky linked an issue Mar 30, 2023 that may be closed by this pull request
@bertsky
Copy link
Collaborator Author

bertsky commented Mar 30, 2023

sorry for the noise – was too lazy to do it locally

@bertsky
Copy link
Collaborator Author

bertsky commented Mar 30, 2023

fixes #413

@bertsky
Copy link
Collaborator Author

bertsky commented Mar 30, 2023

fixes #413

it's really strange: I cannot link to this issue (in text or directly in development). Neither in the opposite direction (from issue to this PR). Another GH quirk?

@kba
Copy link
Member

kba commented Mar 31, 2023

fixes #413

it's really strange: I cannot link to this issue (in text or directly in development). Neither in the opposite direction (from issue to this PR). Another GH quirk?

Apparently so, I cannot link them either...

@bertsky
Copy link
Collaborator Author

bertsky commented Mar 31, 2023

Finally got it working – ready to be merged 😓

@bertsky
Copy link
Collaborator Author

bertsky commented Mar 31, 2023

CI: now only macos failure remains.

@kba
Copy link
Member

kba commented Apr 2, 2023

I struggle to fix the macos test, now it's complaining that bash is too old, I installed bash 5.1.8 via homebrew but that's apparenly not the first bash in $PATH. When I try to debug it via SSH, it restarts the job but does not offer an SSH session. So I'll have to debug that further in the context of the other failing macos tests.

@kba kba merged commit 3a875b5 into OCR-D:master Apr 2, 2023
@bertsky
Copy link
Collaborator Author

bertsky commented Apr 21, 2023

@kba can we please make a quick release 2.50 out of the current master? Remember that in https://github.com/UB-Mannheim/ocrd_pagetopdf/pull/22 I had to require a new 2.50 for the n-ary bashlib fix.

@bertsky bertsky deleted the bashlib-multi-input-files branch June 6, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test multiple file inputs in bashlib bashlib: implement input-files for multiple input fileGrps

2 participants