Nat Hillard added the comment:
Thank you, everyone. Defining a new type for this is just what I needed. No
additional modifications are necessary on top of this new type.
--
resolution: -> works for me
status: open -> closed
___
Python tracker
R. David Murray added the comment:
I had forgotten all about os.path.expandvars. Note, however, that that
function is very naive:
>>> os.path.expandvars("'$HOME'")
"'/home/rdmurray'"
That is, it is doing unconditional substitution, not parsing shell syntax. It
should work well for simpl
Steven Bethard added the comment:
You could try declaring a type converter and using the type= parameter of
add_argument. Your type converter could look something like:
def expanded_path(arg):
return os.path.expandvars(arg)
Would that work?
--
Nat Hillard added the comment:
Indeed these are all valid points, and as a zsh user myself I certainly
considered the alternative shell issue. That said, if it were at all possible,
through a combination of os.environ / shlex, subprocess, and even `source` if
necessary, to offload this interpr