Skip to content

Commit

Permalink
Fixed Completed Process
Browse files Browse the repository at this point in the history
There was a game breaking bug where we didn't actually return the completed process, so there was no way to actually capture the output.

Updated the version and documentation
  • Loading branch information
volitank committed Nov 1, 2021
1 parent fc20e6c commit 0c64c3b
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 30 deletions.
43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# pyshell
A Linux subprocess module, An easier way to interact with the Linux shell
>pyshell should be cross platform but has only been tested with linux
# Installation
`$ pip install https://github.com/volitank/pyshell/releases/download/v1.0.0.a1/pyshell-1.0.0a1-py3-none-any.whl`

or

`$ pip install https://github.com/volitank/pyshell/releases/download/v1.0.0.a1/pyshell-1.0.0a1.tar.gz`

To install the directly from the source code you can use

`$ pip install https://github.com/volitank/pyshell/archive/refs/heads/main.tar.gz`

# Usage

from pyshell import pyshell
shell = pyshell()
shell.echo('Hello', "GitHub!")
# Docs

A Linux subprocess module, An easier way to interact with the Linux shell
>pyshell should be cross platform but has only been tested with linux
# Installation

You can install a specific release by running

`$ pip install https://github.com/volitank/pyshell/releases/download/v1.0.0a2/pyshell-1.0.0a2.tar.gz`

While we're still in early development stages it is preferred that you run directly from the git

`$ pip install https://github.com/volitank/pyshell/archive/refs/heads/main.tar.gz`

# Usage

from pyshell import pyshell
shell = pyshell()
shell.echo('Hello', "GitHub!")

# Docs

Check out the Official [Documentation](https://volitank.com/pyshell/index.html) for help with syntax and different arguments
10 changes: 3 additions & 7 deletions docs/source/sections/initial_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@ Installation

To use pyshell, first install it using pip:

.. code-block:: console
$ pip install https://github.com/volitank/pyshell/releases/download/v1.0.0.a1/pyshell-1.0.0a1-py3-none-any.whl
or
You can install a specific release by running

.. code-block:: console
$ pip install https://github.com/volitank/pyshell/releases/download/v1.0.0.a1/pyshell-1.0.0a1.tar.gz
$ pip install https://github.com/volitank/pyshell/releases/download/v1.0.0a2/pyshell-1.0.0a2.tar.gz
To install the directly from the source code you can use
While we're still in early development stages it is preferred that you run directly from the git

.. code-block:: console
Expand Down
14 changes: 14 additions & 0 deletions docs/source/sections/passing_arguments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ For commands with dashes we use underscores instead. All underscores in the call
shell.echo_test()
# pyshell.pyshell.CommandNotFound: command echo-test does not exist
Switches
--------

Because of the way dashes are coded you can do switches like below.

.. code-block:: python
shell = pyshell()
shell.ls._lah()
# This is the same as
shell.ls("-lah")
# and
shell("ls", "-lah")
Equivalents
-----------

Expand Down
2 changes: 1 addition & 1 deletion pyshell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
__author__ = 'volitank'
__license__ = 'GPLv3'
__copyright__ = '2021 volitank'
__version__ = '1.0.0.a1'
__version__ = '1.0.0a2'

from .pyshell import pyshell, DEFAULT, DEVNULL, PIPE, STDOUT
7 changes: 7 additions & 0 deletions pyshell/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,17 +470,24 @@ def __call__(self, *args,
name, args = self.__parse_attr_commands(self.list, *args)

self.list.clear()

# This block says to error if we're not using the shell and we can't find the command.
# But if we're using the shell then send it anyway. I'm not sure why I did this.
# Maybe we should just send it no matter what?
if kwargs.get('shell') is None and self.kwargs.get('shell') is None:
if shutil.which(name) is not None:
self._run_wrapper( name, *args,
input=input, capture_output=capture_output, check=check,
logfile=logfile, timeout=timeout, **kwargs)
return self.process
else:
raise CommandNotFound(f'command {name} does not exist')
else:
self._run_wrapper( name, *args,
input=input, capture_output=capture_output, check=check,
logfile=logfile, timeout=timeout, **kwargs)
return self.process

def __getattr__(self, attr: str):

# We need to do some check against what was called. So we get our call.
Expand Down

0 comments on commit 0c64c3b

Please sign in to comment.