Skip to content

Commit

Permalink
Add GraphML output option
Browse files Browse the repository at this point in the history
  • Loading branch information
teake committed May 1, 2019
1 parent 3d8ef86 commit 2cbc0e3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ After installation a new Conda command is available:
$ conda depgraph [--help]
[--from-channels]
[--from-env [--name=<ENV_NAME>] [--prefix=<ENV_PATH>]]
[--output-names] [--output-graph]
[--output-names] [--output-graph] [--output-graphml]
[in [--distance=<DISTANCE>] <PACKAGE>]
[out [--distance=<DISTANCE>] <PACKAGE>]
[inout [--distance=<DISTANCE>] <PACKAGE>]
Expand Down
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: conda-depgraph
version: 1.0.1
version: 1.1.0

about:
home: https://github.com/omegacen/conda-depgraph
Expand Down
2 changes: 1 addition & 1 deletion src/conda_depgraph/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.1'
__version__ = '1.1.0'
6 changes: 6 additions & 0 deletions src/conda_depgraph/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools

import click
import networkx
from asciinet import graph_to_ascii

from . import algorithms
Expand All @@ -19,6 +20,8 @@
help='Name of environment.')
@click.option('--output-names', 'output', flag_value='names',
help='Don\'t plot a graph but only return package names.')
@click.option('--output-graphml', 'output', flag_value='graphml',
help='Return a GraphML representation of the graph.')
@click.option('--output-graph', 'output', flag_value='graph', default=True,
help='Plot a graph (default).')
def main(*_, **__):
Expand All @@ -44,6 +47,9 @@ def process_subcommands(subcommands, from_where, prefix, name, output):
if output == 'names':
for n in sorted(g.nodes()):
print(n)
elif output == 'graphml':
for line in networkx.generate_graphml(g):
print(line)
else:
print(graph_to_ascii(g))

Expand Down

0 comments on commit 2cbc0e3

Please sign in to comment.