Skip to content

Commit 77bd808

Browse files
committed
update README
1 parent fb165a7 commit 77bd808

File tree

3 files changed

+128
-2
lines changed

3 files changed

+128
-2
lines changed

README.md

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,28 @@
44
55
_dan_ is a build system inspired from _GNU make_, _cmake_, _meson_, ... but only in python.
66

7+
It is mostly designed to be easy to use, it comes with its [vscode extension](https://github.com/Garcia6l20/dan-vscode) available on the [marketplace](https://marketplace.visualstudio.com/items?itemName=garcia6l20.dan).
8+
9+
It also provide a packaging system called [dan.io](https://github.com/Garcia6l20/dan.io),
10+
that will fetch and build 3rd party libraries.
11+
12+
## Install
13+
14+
_dan_ is available on pip:
15+
16+
```bash
17+
pip install dan-build
18+
```
19+
720
## Features
821

9-
- Generators:
22+
### Generators
1023

1124
Generators are python functions that generates an output:
25+
1226
```python
27+
from dan import generator
28+
1329
@generator(output='hello.txt', dependencies=['source.jinja'])
1430
def hello(self):
1531
env = jinja2.Environment(loader=jinja2.FileSystemLoader(self.source_path))
@@ -18,6 +34,7 @@ def hello(self):
1834
```
1935

2036
They can be async:
37+
2138
```python
2239
@generator(output='hello-cpy.txt', dependencies=[hello])
2340
async def hello_cpy(self):
@@ -27,8 +44,60 @@ async def hello_cpy(self):
2744
await dst.write(await src.read())
2845
```
2946

47+
### C/CXX
3048

31-
## Cli usage:
49+
#### Libraries/Executables
50+
51+
```python
52+
from dan.cxx import Library, Executable
53+
class MyLib(Library):
54+
name = 'my-lib'
55+
sources = ['src/my-lib.cpp']
56+
public_includes = ['include']
57+
58+
class MyExe(Executable):
59+
name = 'my-exe'
60+
sources = ['src/main.cpp']
61+
dependencies = [MyLib]
62+
63+
```
64+
65+
#### Packages
66+
[dan.io](https://github.com/Garcia6l20/dan.io) is the main (default) package source repository (custom repositories are supported by editting _~/.dan/repositories.json_) [documentation comming soon].
67+
```python
68+
class MyExe(Executable):
69+
name = 'my-exe'
70+
sources = ['src/main.cpp']
71+
dependencies = ['boost:headers@dan.io >= 1.82']
72+
```
73+
74+
## dan cli usage
75+
76+
`dan` is the main executable to build your project, it can build, test, list targets/test, ...
77+
78+
```bash
79+
dan --help
80+
Usage: dan [OPTIONS] COMMAND [ARGS]...
81+
82+
Options:
83+
--version Show the version and exit.
84+
-q, --quiet Dont print informations (errors only)
85+
-v, --verbose Pring debug informations
86+
-j, --jobs INTEGER Maximum jobs
87+
--help Show this message and exit.
88+
89+
Commands:
90+
build Build targets
91+
clean Clean generated stuff
92+
code VS-Code specific commands
93+
configure Configure dan project
94+
install Install targets
95+
ls Inspect stuff
96+
run Run executable(s)
97+
scan-toolchains Scan system toolchains
98+
test Run tests
99+
uninstall Uninstall previous installation
100+
```
32101

33102
### Toolchain scan
34103

@@ -63,3 +132,54 @@ Settings:
63132
- *install.includes_prefix*: Includes installation prefix (default: include).
64133
- *install.data_prefix*: Data files installation prefix (default: share).
65134
- *install.project_prefix*: !!! NOT USED YET !!! Project prefix (default: None).
135+
136+
137+
## dan-io cli usage
138+
139+
`dan-io` is a secondary utility to interract with package management system.
140+
141+
```bash
142+
$ dan-io --help
143+
Usage: dan-io [OPTIONS] COMMAND [ARGS]...
144+
145+
Options:
146+
--help Show this message and exit.
147+
148+
Commands:
149+
ls Inspect stuff
150+
search Search for NAME in repositories
151+
```
152+
153+
```bash
154+
$ dan-io ls --help
155+
Usage: dan-io ls [OPTIONS] COMMAND [ARGS]...
156+
157+
Inspect stuff
158+
159+
Options:
160+
--help Show this message and exit.
161+
162+
Commands:
163+
libraries List available libraries
164+
repositories List available repositories
165+
versions Get LIBRARY's available versions
166+
```
167+
168+
169+
## Auto completion
170+
171+
`bash` and `zsh` completions are currently supported:
172+
173+
- bash:
174+
```bash
175+
for script in ~/.local/etc/bash_completion.d/*.sh; do
176+
source ${script}
177+
done
178+
```
179+
180+
- ksh:
181+
```ksh
182+
for script in ~/.local/etc/ksh_completion.d/*.sh; do
183+
source ${script}
184+
done
185+
```

dan/cli/io.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,20 @@ def cli():
5050

5151
@cli.group()
5252
def ls():
53+
"""Inspect stuff"""
5354
pass
5455

5556

5657
@ls.command()
5758
async def repositories():
59+
"""List available repositories"""
5860
repos = await get_repositories()
5961
for repo in repos:
6062
click.echo(repo.name)
6163

6264
@ls.command()
6365
async def libraries():
66+
"""List available libraries"""
6467
repos = await get_repositories()
6568
for repo in repos:
6669
for name, lib in repo.installed.items():
@@ -69,6 +72,7 @@ async def libraries():
6972
@ls.command()
7073
@click.argument('LIBRARY')
7174
async def versions(library: str):
75+
"""Get LIBRARY's available versions"""
7276
package, library, repository = parse_package(library)
7377
repo = await get_repository(repository)
7478
if repo is None:
@@ -98,6 +102,7 @@ async def versions(library: str):
98102
@cli.command()
99103
@click.argument('NAME')
100104
async def search(name):
105+
"""Search for NAME in repositories"""
101106
name = f'*{name}*'
102107
repos = await get_repositories()
103108
for repo in repos:

dan/cli/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def make(self):
7373

7474

7575
@click.group()
76+
@click.version_option(package_name='dan-build')
7677
@click.option('--quiet', '-q', is_flag=True,
7778
help='Dont print informations (errors only)')
7879
@click.option('--verbose', '-v', is_flag=True,

0 commit comments

Comments
 (0)