Skip to content
Snippets Groups Projects
Commit 300c0f81 authored by Phillip Smyth's avatar Phillip Smyth
Browse files

_frontend/cli.py: Added --world to `bst build`

Added --world flag to def build()
Added helper function for walking through dirs to return files
parent 327b19dd
No related branches found
No related tags found
Loading
......@@ -166,6 +166,18 @@ original_main = click.BaseCommand.main
click.BaseCommand.main = override_main
def get_files(project_dir):
output = tuple()
for root, _, files in os.walk(project_dir):
for file in files:
if file.endswith(".bst"):
relDir = os.path.relpath(root, project_dir)
relFile = os.path.join(relDir, file).strip("./")
relFile = relFile.replace('elements/','')
output = output + (relFile,)
return output
##################################################################
# Main Options #
##################################################################
......@@ -305,10 +317,12 @@ def init(app, project_name, format_version, element_path, force):
help="Allow tracking to cross junction boundaries")
@click.option('--track-save', default=False, is_flag=True,
help="Deprecated: This is ignored")
@click.option('--world', 'build_world', default=False, is_flag=True,
help="Build every element in the project")
@click.argument('elements', nargs=-1,
type=click.Path(readable=False))
@click.pass_obj
def build(app, elements, all_, track_, track_save, track_all, track_except, track_cross_junctions):
def build(app, elements, all_, track_, track_save, track_all, track_except, track_cross_junctions, build_world):
"""Build elements in a pipeline"""
if (track_except or track_cross_junctions) and not (track_ or track_all):
......@@ -322,6 +336,13 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac
if track_all:
track_ = elements
if elements and build_world:
click.echo("ERROR: --world cannot be used along side a named element: '{}'".format(elements[0]), err=True)
sys.exit(-1)
if build_world:
elements = get_files(app._main_options.get("directory"))
with app.initialized(session_name="Build"):
app.stream.build(elements,
track_targets=track_,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment