You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's the expected and desired behaviour: you write a function that takes some arguments and returns something, then simply "dispatch" it via argh and it magically becomes also a CLI endpoint which takes arguments and returns text which you can redirect elsewhere, as you would do in Python.
it's a validator function, basically it checks if an input directory matches some standard conventions, logs errors or warnings, and returns a very large list of dictionaries for valid files. That's hardly usable as such in the CLI and clutters the terminal.
The thing is stdout and return are two different things. It seems a bit strange that return would end up in the terminal window with everything else.
I could add a return_metadata parameter which is set to False by default and then I would need to remember to always enable it for Python usage, but that would unnecessarily complicate function usage.
Another approach would be to do the same thing via a wrapper function, but the validation is done using said list of dictionaries so that variable is passed around anyway, in a sense this wrapper would just emulate the aforementioned solution.
I really think the most elegant way to do it would be if I could tell argh to just suppress return output. Is there really no way to do that?
As it stands, if the function which I dispatch has a
return
statement, all of that ends up in my stdout. Is there any way to suppress this?The text was updated successfully, but these errors were encountered: