Skip to content

Commit

Permalink
Merge pull request #104 from INTI-CMNB/recover_cli_script
Browse files Browse the repository at this point in the history
Recover the KiBOM_CLI.py script.
  • Loading branch information
SchrodingersGat committed Jul 17, 2020
2 parents 235694a + 1ea8645 commit 23031f7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
28 changes: 28 additions & 0 deletions KiBOM_CLI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3
"""
@package
KiBOM - Bill of Materials generation for KiCad
Generate BOM in xml, csv, txt, tsv, html or xlsx formats.
- Components are automatically grouped into BoM rows (grouping is configurable)
- Component groups count number of components and list component designators
- Rows are automatically sorted by component reference(s)
- Supports board variants
Extended options are available in the "bom.ini" config file in the PCB directory
(this file is auto-generated with default options the first time the script is executed).
For usage help:
python -m kibom -h
"""

import sys
import os

here = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, here)

from kibom.__main__ import main # noqa: E402

main()
5 changes: 4 additions & 1 deletion kibom/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def writeVariant(input_file, output_dir, output_file, variant, preferences):
def main():
locale.setlocale(locale.LC_ALL, '')

parser = argparse.ArgumentParser(prog="python -m kibom", description="KiBOM Bill of Materials generator script")
prog = 'KiBOM_CLI.py'
if __name__ == '__main__':
prog = "python -m kibom"
parser = argparse.ArgumentParser(prog=prog, description="KiBOM Bill of Materials generator script")

parser.add_argument("netlist", help='xml netlist file. Use "%%I" when running from within KiCad')
parser.add_argument("output", default="", help='BoM output file name.\nUse "%%O" when running from within KiCad to use the default output name (csv file).\nFor e.g. HTML output, use "%%O.html"')
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
license="MIT",

packages=setuptools.find_packages(),

scripts=['KiBOM_CLI.py'],

install_requires=[
"xlsxwriter",
Expand Down

0 comments on commit 23031f7

Please sign in to comment.