piper.magics.PipeMagic.parse_options¶
-
PipeMagic.parse_options(arg_str, opt_str, *long_opts, **kw)[source]¶ Parse options passed to an argument string.
The interface is similar to that of
getopt.getopt(), but it returns aStructwith the options as keys and the stripped argument string still as a string.arg_str is quoted as a true sys.argv vector by using shlex.split. This allows us to easily expand variables, glob files, quote arguments, etc.
- Parameters
arg_str (str) – The arguments to parse.
opt_str (str) – The options specification.
mode (str, default 'string') – If given as ‘list’, the argument string is returned as a list (split on whitespace) instead of a string.
list_all (bool, default False) – Put all option values in lists. Normally only options appearing more than once are put in a list.
posix (bool, default True) – Whether to split the input line in POSIX mode or not, as per the conventions outlined in the
shlexmodule from the standard library.