docs: design

This commit is contained in:
Daylin Morgan 2024-10-22 11:53:27 -05:00
parent 277f7f7c0c
commit a47b8e7927
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -41,6 +41,7 @@ def pipe_commands()
Made even simpler with operator overloading: Made even simpler with operator overloading:
```python ```python
@task @task
def run_commands(): def run_commands():
@ -48,6 +49,17 @@ def run_commands():
print(stdout) print(stdout)
``` ```
Upon reflection I think the operator overloading is wildly confusing.
I think it will make more sense to try to develop chainable objects:
Make `sub(cmd, **kwargs)` and alias for `proc(cmd).run(**kwargs)`
```python
@task
def run_commands():
stdout = proc("find . -name file").pipe("grep 'pattern'").get()
print(stdout)
```
## Internal CLI ## Internal CLI
@ -56,5 +68,5 @@ def run_commands():
# vs # vs
./tasks.py _swydd-subcmd ./tasks.py _swydd-subcmd
# or # or
./tasks.py +swydd-subcmd # <- current favorite (use a none valid function name to possibly prevent overlap) ./tasks.py +swydd subcmd # <- current favorite (use a none valid function name to possibly prevent overlap)
``` ```