Add list sub command.
This commit is contained in:
parent
01840c7312
commit
45a5ca6592
1 changed files with 18 additions and 7 deletions
|
@ -1,12 +1,12 @@
|
||||||
import importlib
|
import importlib
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import random
|
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
|
|
||||||
import osdk.build as build
|
import osdk.build as build
|
||||||
import osdk.utils as utils
|
import osdk.utils as utils
|
||||||
import osdk.targets as targets
|
import osdk.targets as targets
|
||||||
|
import osdk.manifests as manifests
|
||||||
|
|
||||||
|
|
||||||
CMDS = {}
|
CMDS = {}
|
||||||
|
@ -52,6 +52,19 @@ def buildCmd(opts: dict, args: list[str]) -> None:
|
||||||
build.buildOne(targetName, component)
|
build.buildOne(targetName, component)
|
||||||
|
|
||||||
|
|
||||||
|
def listCmd(opts: dict, args: list[str]) -> None:
|
||||||
|
targetName = opts.get('target', 'host-clang')
|
||||||
|
target = targets.load(targetName)
|
||||||
|
components = manifests.loadAll("src", target)
|
||||||
|
|
||||||
|
print(f"Available components for target '{targetName}':")
|
||||||
|
componentsNames = list(components.keys())
|
||||||
|
componentsNames.sort()
|
||||||
|
for component in componentsNames:
|
||||||
|
print(" " + component)
|
||||||
|
print("")
|
||||||
|
|
||||||
|
|
||||||
def cleanCmd(opts: dict, args: list[str]) -> None:
|
def cleanCmd(opts: dict, args: list[str]) -> None:
|
||||||
shutil.rmtree(".build", ignore_errors=True)
|
shutil.rmtree(".build", ignore_errors=True)
|
||||||
|
|
||||||
|
@ -61,12 +74,6 @@ def nukeCmd(opts: dict, args: list[str]) -> None:
|
||||||
shutil.rmtree(".cache", ignore_errors=True)
|
shutil.rmtree(".cache", ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def idCmd(opts: dict, args: list[str]) -> None:
|
|
||||||
i = hex(random.randint(0, 2**64))
|
|
||||||
print("64bit: " + i)
|
|
||||||
print("32bit: " + i[:10])
|
|
||||||
|
|
||||||
|
|
||||||
def helpCmd(opts: dict, args: list[str]) -> None:
|
def helpCmd(opts: dict, args: list[str]) -> None:
|
||||||
print(f"Usage: osdk <command> [options...] [<args...>]")
|
print(f"Usage: osdk <command> [options...] [<args...>]")
|
||||||
print("")
|
print("")
|
||||||
|
@ -104,6 +111,10 @@ CMDS = {
|
||||||
"func": buildCmd,
|
"func": buildCmd,
|
||||||
"desc": "Build one or more components",
|
"desc": "Build one or more components",
|
||||||
},
|
},
|
||||||
|
"list": {
|
||||||
|
"func": listCmd,
|
||||||
|
"desc": "List available components",
|
||||||
|
},
|
||||||
"clean": {
|
"clean": {
|
||||||
"func": cleanCmd,
|
"func": cleanCmd,
|
||||||
"desc": "Clean the build directory",
|
"desc": "Clean the build directory",
|
||||||
|
|
Loading…
Add table
Reference in a new issue