aboutsummaryrefslogtreecommitdiff
path: root/trygvis/eda/cli
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-12-28 16:37:39 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2017-01-05 09:24:41 +0100
commite92fb46ec42991dca60d22d8b1ab321b7c4ff146 (patch)
tree8eff3bf9472d4964098846fdbc8eb8d3438700bf /trygvis/eda/cli
parent673dcbcab144a274bbc26a926d4a735275519b92 (diff)
downloadeda-rdf-e92fb46ec42991dca60d22d8b1ab321b7c4ff146.tar.gz
eda-rdf-e92fb46ec42991dca60d22d8b1ab321b7c4ff146.tar.bz2
eda-rdf-e92fb46ec42991dca60d22d8b1ab321b7c4ff146.tar.xz
eda-rdf-e92fb46ec42991dca60d22d8b1ab321b7c4ff146.zip
o Adding --force flag to digikey-download-for-schematic.
o Unbreaking download_product().
Diffstat (limited to 'trygvis/eda/cli')
-rwxr-xr-xtrygvis/eda/cli/digikey_download_for_schematic.py6
-rwxr-xr-xtrygvis/eda/cli/digikey_download_metadata.py2
-rw-r--r--trygvis/eda/cli/eda_rdf.py3
-rwxr-xr-xtrygvis/eda/cli/make_bom.py2
4 files changed, 8 insertions, 5 deletions
diff --git a/trygvis/eda/cli/digikey_download_for_schematic.py b/trygvis/eda/cli/digikey_download_for_schematic.py
index 4be2632..bf4f0ce 100755
--- a/trygvis/eda/cli/digikey_download_for_schematic.py
+++ b/trygvis/eda/cli/digikey_download_for_schematic.py
@@ -5,7 +5,7 @@ from trygvis.eda import cli
from trygvis.eda.digikey import *
-def work(schematic_url, g):
+def work(schematic_url, force, g):
client = DigikeyClient()
db = DigikeyDatabase()
download_category_tree(db, client)
@@ -79,9 +79,9 @@ ORDER BY ?digikey_pn
[g.add(node) for node in product.to_nodes()]
return g
- cli.write_graph(download_graph, filename)
+ cli.write_graph(download_graph, filename, force_write=force)
def run(schematic_url, args):
cli.info("Schematic: %s" % schematic_url)
- cli.with_database(lambda g: work(schematic_url, g))
+ cli.with_database(lambda g: work(schematic_url, args.force, g))
diff --git a/trygvis/eda/cli/digikey_download_metadata.py b/trygvis/eda/cli/digikey_download_metadata.py
index d807c1a..60880ab 100755
--- a/trygvis/eda/cli/digikey_download_metadata.py
+++ b/trygvis/eda/cli/digikey_download_metadata.py
@@ -41,5 +41,5 @@ def run(args):
for pc in db.productCategories:
for sc in pc.subCategories:
- output = "%s/digikey-%s.ttl" % (args.output_dir, normalize_filename(sc.label))
+ output = "%s/digikey-category-%s.ttl" % (args.output_dir, normalize_filename(sc.label))
do_category(client, sc, output)
diff --git a/trygvis/eda/cli/eda_rdf.py b/trygvis/eda/cli/eda_rdf.py
index 7b4ed2c..ee4b0dd 100644
--- a/trygvis/eda/cli/eda_rdf.py
+++ b/trygvis/eda/cli/eda_rdf.py
@@ -9,6 +9,8 @@ class CliCommand(object):
self.description = description
+# TODO: move all of the command classes to the file they delegate to.
+
class AddToDb(CliCommand):
def __init__(self):
super().__init__("add-to-db", "Import RDF triplet file to the database")
@@ -55,6 +57,7 @@ class DigikeyDownloadForSchematic(CliCommand):
def run(self, argv):
p = argparse.ArgumentParser(prog=self.key, description=self.description)
p.add_argument("--schematic", required=True)
+ p.add_argument("-f", "--force", default=False, action='store_true')
args = p.parse_args(argv)
from trygvis.eda.cli import digikey_download_for_schematic
diff --git a/trygvis/eda/cli/make_bom.py b/trygvis/eda/cli/make_bom.py
index fcdbe99..8d8c9f1 100755
--- a/trygvis/eda/cli/make_bom.py
+++ b/trygvis/eda/cli/make_bom.py
@@ -104,4 +104,4 @@ ORDER BY ?ref ?attr_type ?attr_value
part = dk_parts[pn]
part.set_attribute(row.type, row.value)
- cli.info('%5s: %-20s %s' % (pn, row.type + ':', row.value))
+ cli.info('%-30s %-50s %s' % (pn, row.type + ':', row.value))