[ENH] separate_arguments enhancement
For now, get_filename_component()
command can parse and split a command line by using sub-command PROGRAM
.
This is a bit problematic:
- not at all consistent because a command dedicated to split command line exists:
separate_arguments()
- current implementation is not able to split program arguments, if any
So I propose to supersede the current functionality by the following extension to separate_arguments()
command:
separate_arguments (<variable> <mode> [PROGRAM [SEPARATE_ARGS]] <args>)
By adding PROGRAM
keyword, the input argument is split in two elements (one for the program, one for the arguments), so having the same behavior as get_filename_component(PROGRAM)
.
If SEPARATE_ARGS
option is specified as well, the input argument is fully parsed and splited (program and arguments).
In all cases, the result is returned as a list in the output variable. If the program cannot be found, an empty list is returned. In all other cases, the program is the first element of the list.