adafruit / Adafruit_Python_Shell

Python helper for running Shell scripts in Python
MIT License
6 stars 3 forks source link

Simple documentation #19

Closed ShalokShalom closed 1 year ago

ShalokShalom commented 1 year ago

Hi there :)

First - the API documentation is well hidden, and its almost impossible to find on the README. :) Second - I miss simple examples, particularly about sending shell commands and receiving their outputs.

The API documentation seems to be a bit too elaborate for me, thanks.

makermelissa commented 1 year ago

Yeah, fair enough. This was developed mostly for use with https://github.com/adafruit/Raspberry-Pi-Installer-Scripts to assist in conversion to Python scripts. However, there are definitely some useful things in this library for other uses.

ShalokShalom commented 1 year ago

Wonderful. I would mostly like to understand, how to simply launch a command, and how to get stderr and stdout back 😃

makermelissa commented 1 year ago

The best example script is probably https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/main/adafruit-pitft.py. The main function for running commands is: run_command(self, cmd, suppress_message=False, return_output=False)

Stderr and stdout are combined in the function (though they call different functions to write the message back to the console). All output is returned if return_output is True and it is not printed to the console if suppress_message is True.

ShalokShalom commented 1 year ago

Do we want to include this in the readthedocs?

makermelissa commented 1 year ago

Eventually. I think the code just needs to have someone (probably me) go through it and have docstrings added for the public functions or at least the more commonly used ones.

ShalokShalom commented 1 year ago

Well, that would be more API documentation. I mean docs who can be read by the average Joe. Something you would include in a Readme. Something like a quick start. 👍🏻