astrofrog / batchpr

Package in need of a better name to automate opening pull requests :robot:
BSD 2-Clause "Simplified" License
3 stars 5 forks source link

Where is --verbose passed in? #16

Closed pllim closed 5 years ago

pllim commented 5 years ago
        if ('--verbose' in sys.argv or p.returncode != 0) and output:
            print(indent(output, ' ' * 4))

How is --verbose passed into sys.argv here in run_command()? Is it automagically extracted from command?

pllim commented 5 years ago

From README:

When running your script, you can add ``--verbose`` to see the output of the
commands, and ``--dry`` to not open pull requests.

But how does one run the script and pass in such things? I don't see any if __name__ == '__main__' directive.

astrofrog commented 5 years ago

Just pass it to the python interpreter when executing your update script, it will pass all the way through

pllim commented 5 years ago

So am I correct to say that the whole example of how to enable passing of this in an update script is missing?

astrofrog commented 5 years ago

It will automatically be passed through and no changes are required to an update script. If you do:

python update.py --verbose

any python function/method called as a result of that can have access to sys.argv

pllim commented 5 years ago

Ok, so these options are for a very specific workflow of writing that subclass in a Python script and running it from command line. I wonder if we can make it possible to use from inside a Python session. I'll have to think about it. Thanks for the clarification!