Skip to content

[enhancement] Add --output/-o CLI option to change output file name #8

@bwpge

Description

@bwpge

Just wanted to say great work on this tool, it is very well put together.

In my testing, I found I wanted to be able to change the output file name from opengraph.json to something else. I skimmed around the code, I think this would be fairly straightforward for me to send a PR in to add, but figured was better to discuss first before sending.

Plan would be only a few changes in __main__.py:

  • Add CLI argument to parser around line 126:
    parser.add_argument("--logfile", default=None, help="Log file to write to")
  • Adjust usage for the new output name here around lines 394-401:
    logger.info('Exporting graph to "%s"' % "opengraph.json")
    logger.increment_indent()
    logger.info("Nodes: %d" % graph.get_node_count())
    logger.info("Edges: %d" % graph.get_edge_count())
    graph.export_to_file("opengraph.json", include_metadata=False)
    logger.info(
    'Graph successfully exported to "%s" (%s)'
    % ("opengraph.json", filesize(os.path.getsize("opengraph.json")))

Let me know your thoughts, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions