Open
Description
Unlike the default Flask shell, this one allows to specify a script to execute, just like outside of Flask do ipython script.py
and python script.py
. However passing options to a script invoked that way may require a preceding --
separator, which is being dropped by click
library and never makes it to IPython.start_ipython(argv=ipython_args,
Demonstration:
$ echo 'import sys; print(sys.argv)' >script.py
Works as expected:
$ flask shell script.py --test test
[TerminalIPythonApp] WARNING | Unrecognized alias: 'test', it will have no effect.
['/usr/src/script.py']
Doesn't work as expected:
$ flask shell script.py -- --test test
[TerminalIPythonApp] WARNING | Unrecognized alias: 'test', it will have no effect.
['/usr/src/script.py']
Expected result in the second case:
$ flask shell script.py -- --test test
['/usr/src/script.py', '--test', 'test']
It seems that the required feature is missing in click
, though may be added in pallets/click#2205 (see also pallets/click#619 and pallets/click#1340).
I realize that this may not have been a planned feature, but this would be a nice extra thing that the default Flask shell doesn't offer.
Metadata
Metadata
Assignees
Labels
No labels