diff --git a/.vscode/launch.json b/.vscode/launch.json index d811265..4a5da5b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -35,7 +35,7 @@ "type": "debugpy", "request": "launch", "program": "icm-run.py", - "args": ["install","iceK", "iceWires"], + "args": ["install","iceK", "iceWires", "--all"], //"console": "internalConsole", "console": "integratedTerminal", "justMyCode": true, diff --git a/icm/__main__.py b/icm/__main__.py index 7910731..7b4768a 100644 --- a/icm/__main__.py +++ b/icm/__main__.py @@ -55,10 +55,13 @@ def info(): @click.option( "-d", "--dev", is_flag=True, help="Install latest development version" ) -def install(coltag, dev): +@click.option( + "-a", "--all", is_flag=True, help="Install all stable collections" +) +def install(coltag, dev, all_): """Install collections""" - cmd_install.main(coltag, dev) + cmd_install.main(coltag, dev, all_) @cli.command() diff --git a/icm/commands/cmd_install.py b/icm/commands/cmd_install.py index 44606df..1e81e2c 100644 --- a/icm/commands/cmd_install.py +++ b/icm/commands/cmd_install.py @@ -5,13 +5,15 @@ import click from icm.commons import commons +from icm.commons import store -def main(coltags: tuple, dev: bool) -> None: +def main(coltags: tuple, dev: bool = False, all_: bool = False) -> None: """ENTRY POINT: Install collections * coltag: tupla de nombres de la coleccion + tag opcional Ex. (iceK, iceK@0.1.4) * dev: Install development version + * all: Install ALL stable collections """ # -- Get context information @@ -20,6 +22,13 @@ def main(coltags: tuple, dev: bool) -> None: print() + # -- "--all" has the highest priority + # -- First check it! + if all_: + for coltag in store.COLLECTIONS["stable"]: + install_collection(collection, coltag, dev) + return + # -- Install the collections! for coltag in coltags: install_collection(collection, coltag, dev) diff --git a/icm/commands/cmd_list.py b/icm/commands/cmd_list.py index ee55161..57c8d3e 100644 --- a/icm/commands/cmd_list.py +++ b/icm/commands/cmd_list.py @@ -2,54 +2,7 @@ import click from icm.commons import commons - - -# -- AVAILABLE collections -COLLECTION_STORE = { - "stable": [ - "iceK", - "iceWires", - "iceIO", - "iceGates", - "iceMux", - "iceCoders", - "iceFF", - "iceRegs", - "iceSRegs", - ], - "dev": [ - "iceBoards", - "iceComp", - "iceArith", - "iceCounters", - "iceSignals", - "icePLL", - "iceLEDOscope", - "iceLEDs", - "iceHearts", - "iceInputs", - "iceRok", - "iceMachines", - "iceSerial", - "iceMem", - "iceMeassure", - "iceStack", - "iceFlash", - "iceBus", - "iceLCD", - "iceSynth", - "icecrystal", - "icebreaker", - "Collection-stdio", - "LOVE-FPGA-Collection", - "Collection-Jedi", - "CT11-collection", - "collection-generic", - "collection-logic", - "ice-chips-verilog", - "Icestudio-ArithmeticBlocks", - ], -} +from icm.commons import store def list_collections( @@ -64,7 +17,7 @@ def list_collections( click.secho(f"{'Name':<15} {'Version':<8} Description", fg=fg) click.secho(f"{'─'*15:<15} {'─'*8:<8} {'─'*20}", fg=fg) - for name in COLLECTION_STORE[typec]: + for name in store.COLLECTIONS[typec]: # Calculate the url for the collection package.json file url = collection.package_url(name) diff --git a/icm/commons/store.py b/icm/commons/store.py index 70e7a79..d2b265c 100644 --- a/icm/commons/store.py +++ b/icm/commons/store.py @@ -1,3 +1,5 @@ +"""Collection store!: Available collections""" + COLLECTIONS = { "stable": [ "iceK",