Closed wtanksleyjr closed 3 years ago
I figured this out, I think -- I'm not sure, but it looks like I'm supposed to access the SwitchAttr variable as self.CACHE_FILE
(to use the above example), except sometimes when that's not needed. I'm not sure what's going on there, but I was able to solve my specific problem. I think.
As someone just trying to use the new-to-me feature of cli.SwitchAttr and Flag, I'd like to quickly print the value loaded from the command line (or environment variable).
I wrote is:
What I see is:
cache: <plumbum.cli.switches.SwitchAttr object at 0x7fa1e5f54ac0>
What I expected to see is:cache: ./testfile.txt
(WriteableFile is my own attempt to make a validator, of course it's part of why I'm inserting print statements, but this also happens with
cli.Flag
and no validation.)So... how to I get the actual value that was passed (and/or returned by the validator, I'm not sure what's expected to happen there), and why is doing this so surprisingly non-obvious, when the documentation makes it look like everything's all the same as normal Python?