Opened 13 years ago

Closed 9 years ago

#570 closed enhancement (fixed)

omindex --filter option for comands that don't take input file as last argument

Reported by: Charles Owned by: Olly Betts
Priority: normal Milestone: 1.3.3
Component: Omega Version: 1.2.5
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description

Could the omindex --filter option be modified to service commands that do not take the input file as the last argument?

An example (not a good one because omindex uses it by default if available) is pdftotext. From the pdftotext man page:

SYNOPSIS
pdftotext [options] [PDF-file [text-file]]

DESCRIPTION
Pdftotext converts Portable Document Format (PDF) files to plain text.

Pdftotext reads the PDF file, PDF-file, and writes a text file,
text-file. If text-file is not specified, pdftotext converts
file.pdf to file.txt.  If text-file is '-', the text is sent to
stdout.

One way to implement this would be to accept %f as a token for the input file name. In case a literal %f was required in the command it could be escaped as \%f.

For the pdftotext example the full option would be:

--filter 'application/pdf:pdftotext %f -'

Change History (3)

comment:1 by Olly Betts, 12 years ago

This certainly could be done - the current support was really just the simplest start to allowing filters to be specified which supported a lot of existing filters (and you can at least currently wrap others in a simple script to tweak the argument order).

Escaping '%' would be better done by doubling it '%%' as that's consistent with printf, etc.

Last edited 10 years ago by Olly Betts (previous) (diff)

comment:2 by Olly Betts, 10 years ago

Milestone: 1.3.x
Status: newassigned

comment:3 by Olly Betts, 9 years ago

Milestone: 1.3.x1.3.3
Resolution: fixed
Status: assignedclosed

Implemented in [8d88730c47334b50dd6d84b587075aac5e33f561] for 1.3.3. Since such commands don't seem very common, and a wrapper script provides a simple workaround, I don't think this is worth backporting at this point.

I've also added support for output to a temporary file (via %t in the command) in [f68b89227173c55d7a533f7cbd6697f891f8799a]. For example (but not a good example as pdftotext supports output to stdout, which is likely to be faster): --filter='application/pdf:pdftotext %f %t'

Note: See TracTickets for help on using tickets.