Skip to content

Conversation

@alanbacon
Copy link

(includes PR:1, can be merged instead of PR:1)

The passed in list will be checked for correctness, unpacked and appended to the orginal command

From updated readme:


Pass in arguments as an array::

>>> bash('ls', ['.'])
bash.pyc
tests.pyc

Because arguments can now be passed in as a list and because we can get the results of the previous call as a list: we can implement the xargs function. Where the results of the previous call are mapped onto the next function:


>>> bash('ls').bash('grep "\.py"').xargs('grep "author=\'Alex Couper\'"')
'setup.py:    author=\'Alex Couper\','

Which is similar to, but not exactly the same as (due to how grep works):

>>> results = [f for f in bash('ls').bash('grep "\.py"')]
>>> list(map(
              lambda f: [f, bash('grep "author=\'Alex Couper\'"' + f)]
         ))
[  [''setup.py', '    author=\'Alex Couper\',']  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant