mirror of
https://github.com/daylinmorgan/swydd.git
synced 2024-11-06 17:23:16 -06:00
docs: design
This commit is contained in:
parent
277f7f7c0c
commit
a47b8e7927
1 changed files with 13 additions and 1 deletions
14
DESIGN.md
14
DESIGN.md
|
@ -41,6 +41,7 @@ def pipe_commands()
|
|||
|
||||
Made even simpler with operator overloading:
|
||||
|
||||
|
||||
```python
|
||||
@task
|
||||
def run_commands():
|
||||
|
@ -48,6 +49,17 @@ def run_commands():
|
|||
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
|
||||
|
||||
|
@ -56,5 +68,5 @@ def run_commands():
|
|||
# vs
|
||||
./tasks.py _swydd-subcmd
|
||||
# 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)
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue