summaryrefslogtreecommitdiff
path: root/cli/commands
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-07-10 21:29:14 +0200
committerJules Laplace <julescarbon@gmail.com>2020-07-10 21:29:14 +0200
commitcc465329a2261b7db11c12665cab62affb266592 (patch)
treeb97dc7bd7f8e51755268ab04a0d2ef23e584ebe2 /cli/commands
parent0a341a1f6e1d805143dc13e56bc67394840118b4 (diff)
start with the mouseenter, and the export ;)
Diffstat (limited to 'cli/commands')
-rw-r--r--cli/commands/site/export.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/cli/commands/site/export.py b/cli/commands/site/export.py
new file mode 100644
index 0000000..8212f55
--- /dev/null
+++ b/cli/commands/site/export.py
@@ -0,0 +1,38 @@
+import click
+
+from app.settings import app_cfg
+
+@click.command('info')
+@click.option('-g', '--graph', 'opt_graph_path', required=True,
+ help='Graph name')
+@click.option('-o', '--output', 'opt_output_dir', required=True, default=app_cfg.DIR_EXPORTS,
+ help='Output dir')
+@click.pass_context
+def cli(ctx, opt_graph_path, opt_output_dir):
+ """Export a graph"""
+
+ # ------------------------------------------------
+ # imports
+
+ from os.path import join
+
+ from app.sql.common import db, Session, Graph, Page, Tile
+
+ # ------------------------------------------------
+ # generate HTML for all pages
+
+ session = Session()
+ graph = session.query(Graph).filter(Graph.path == opt_graph_path).first()
+ if graph is None:
+ print(f"Not a graph: {opt_graph_path}")
+ return
+
+ for page in graph.pages:
+ page_path = f'{graph.path}/{page.path}'
+ if page.id == graph.home_page_id:
+ print(f'/{page_path} [index]')
+ else:
+ print(f'/{page_path}')
+ #
+ # ------------------------------------------------
+ # cat all the relevant CSS from the main site