Consider this simple Python command-line script:
"""foobar
Description
Usage:
foobar [options] <files>...
Arguments:
<files> List of files.
Options:
-h, --help Show help.
--version Show version.
"""
import docopt
args = docopt.docopt(__doc__)
print(args['<files>'])
And consider that I have the following files in a folder:
file1.pdffile 2.pdf
Now I want to pass the output of the find command to my simple command-line script. But when I try
foobar `find . -iname '*.pdf'`
I don't get the list of files that I wanted, because the input is split on spaces. I.e. I get:
['./file', '2.pdf', './file1.pdf']
How can I correctly do this?