Skip to content

Commit 4e03639

Browse files
Update README - v0.2.0
1 parent a19790a commit 4e03639

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

README.md

+30-26
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pip3 install buildme
4141
```python
4242
#!/bin/env buildme
4343
from argparse import Namespace # for type hinting purposes only
44-
from buildme import CommandRunner
44+
from buildme import CommandRunner, target
4545

4646

4747
cr = CommandRunner(
@@ -55,17 +55,33 @@ cr = CommandRunner(
5555
# method CommandRunner.set_exit_non_zero(vel: bool)
5656

5757

58-
def hello(opts: Namespace):
58+
@target(depends=['test'])
59+
def hello(opts: Namespace, _):
5960
print(opts)
6061
code = cr.run('echo Hello World')
6162
print(f'{code=}')
6263

6364

64-
def test(opts: Namespace):
65-
if opts.release == '0':
65+
@target()
66+
def test(opts: Namespace, _):
67+
if getattr(opts, 'release', None) is not None and opts.release == '0':
6668
print('release is zero')
6769
print('This from test')
6870

71+
72+
@target()
73+
def foo(_, __):
74+
print('This is the foo target')
75+
76+
77+
@target()
78+
def bar(_, __):
79+
print('This is the bar target')
80+
81+
82+
@target(depends=['test'])
83+
def all(_, __): pass
84+
6985
```
7086

7187
- Make it executable
@@ -78,6 +94,7 @@ chmod +x ./buildme
7894

7995
```console
8096
$ ./buildme hello
97+
This from test
8198
Namespace()
8299
================================================================================
83100
[CMD]: echo Hello World
@@ -86,38 +103,25 @@ Hello World
86103
code=0
87104
```
88105

89-
```console
90-
$ ./buildme hello test --release=0
91-
Namespace(release='0')
92-
================================================================================
93-
[CMD]: echo Hello World
94-
Hello World
95-
================================================================================
96-
code=0
97-
release is zero
98-
This from test
99-
```
100-
101106
> Order matters
102107
103108
```console
104-
$ ./buildme test hello --release=0
105-
release is zero
106-
This from test
107-
Namespace(release='0')
108-
================================================================================
109-
[CMD]: echo Hello World
110-
Hello World
111-
================================================================================
112-
code=0
109+
$ ./buildme foo bar
110+
This is the foo target
111+
This is the bar target
112+
113+
$ ./buildme bar foo
114+
This is the bar target
115+
This is the foo target
116+
113117
```
114118

115119
- Helper functions
116120

117121
`buildme` has currently two helper functions
118122

119123
```python
120-
from buildme import mkdir, touch
124+
from buildme import mkdir, touch, rmdir, rm, get_files_in_dir
121125
```
122126

123127
# Bye....

0 commit comments

Comments
 (0)