summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-01-16 15:59:31 +0100
committerJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-01-16 15:59:31 +0100
commit54b796e0c7170a52c754273c3ea3ddd639f9b21a (patch)
tree3dc6433a6a308095670e368939a3a6695c150c8e
parentcb0cd888bafbdf5d86a56ec1213bcb9024b2db75 (diff)
downloadqtivi-qface-54b796e0c7170a52c754273c3ea3ddd639f9b21a.tar.gz
moved the CSV example to examples folder
-rw-r--r--examples/csv/README.md8
-rwxr-xr-xexamples/csv/csv.py26
-rw-r--r--examples/csv/templates/modules.csv (renamed from generator/csv/templates/modules.csv)0
-rwxr-xr-xgenerator/csv/csv.py22
4 files changed, 34 insertions, 22 deletions
diff --git a/examples/csv/README.md b/examples/csv/README.md
new file mode 100644
index 0000000..d42915d
--- /dev/null
+++ b/examples/csv/README.md
@@ -0,0 +1,8 @@
+# CSV Generator
+
+This example provides a generator which reads in a set of interface files and generates a CSV file with an overview of the interfaces, structs and enums from the interface files.
+
+```sh
+./csv.py ../interfaces .
+```
+
diff --git a/examples/csv/csv.py b/examples/csv/csv.py
new file mode 100755
index 0000000..d885f91
--- /dev/null
+++ b/examples/csv/csv.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+# Copyright (c) Pelagicore AB 2016
+
+import click
+from qface.generator import FileSystem, Generator
+
+
+def run(src, dst):
+ system = FileSystem.parse(src)
+ generator = Generator(searchpath='templates')
+ ctx = {'dst': dst, 'system': system}
+ generator.write('{{dst}}/modules.csv', 'modules.csv', ctx)
+
+
+@click.command()
+@click.argument('src', nargs=-1, type=click.Path(exists=True))
+@click.argument('dst', nargs=1, type=click.Path(exists=True))
+def app(src, dst):
+ """Generates a modules,csv file with statistics about all
+ interfaces, structs and enums from the given interface
+ sources"""
+ run(src, dst)
+
+
+if __name__ == '__main__':
+ app()
diff --git a/generator/csv/templates/modules.csv b/examples/csv/templates/modules.csv
index 567dc43..567dc43 100644
--- a/generator/csv/templates/modules.csv
+++ b/examples/csv/templates/modules.csv
diff --git a/generator/csv/csv.py b/generator/csv/csv.py
deleted file mode 100755
index 3636997..0000000
--- a/generator/csv/csv.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) Pelagicore AB 2016
-
-import click
-from qface.generator import FileSystem, Generator
-
-
-def generate(input, output):
- system = FileSystem.parse_dir(input)
- generator = Generator(searchpath='templates')
- ctx = {'output': output, 'system': system}
- generator.write('{{output}}/modules.csv', 'modules.csv', ctx)
-
-
-@click.command()
-@click.option('--input', type=click.Path(exists=True))
-@click.option('--output', type=click.Path(exists=True))
-def runner(input, output):
- generate(input, output)
-
-if __name__ == '__main__':
- runner()