add command not found error

This commit is contained in:
2021-10-24 06:01:39 +01:00
parent 70129585a8
commit c85a006810

View File

@@ -32,6 +32,8 @@ def new(scope, inputs, dry_run):
Example: tembo new meeting my_presentation Example: tembo new meeting my_presentation
""" """
_name_found = scope in [user_scope["name"] for user_scope in tembo.CONFIG.scopes]
if _name_found:
for user_scope in tembo.CONFIG.scopes: for user_scope in tembo.CONFIG.scopes:
if user_scope["name"] == scope: if user_scope["name"] == scope:
scoped_page = pages.ScopedPageCreator().create_page( scoped_page = pages.ScopedPageCreator().create_page(
@@ -41,11 +43,14 @@ def new(scope, inputs, dry_run):
extension=str(user_scope["extension"]), extension=str(user_scope["extension"]),
name=str(user_scope["name"]), name=str(user_scope["name"]),
user_input=inputs, user_input=inputs,
template_filename=str(user_scope["template_filename"]), template_filename=str(user_scope["template_filename"])
) )
scoped_page.save_to_disk(dry_run=dry_run) scoped_page.save_to_disk(dry_run=dry_run)
tembo.logger.info("Saved %s to disk", scoped_page.path) tembo.logger.info("Saved %s to disk", scoped_page.path)
raise SystemExit(0) raise SystemExit(0)
if not _name_found and len(tembo.CONFIG.scopes) > 0:
tembo.logger.warning("Command %s not found in config.yml - exiting", scope)
raise SystemExit(0)
tembo.logger.critical( tembo.logger.critical(
"No config.yml found in %s - exiting", tembo.CONFIG.config_path "No config.yml found in %s - exiting", tembo.CONFIG.config_path
) )
@@ -56,4 +61,6 @@ run.add_command(new)
if __name__ == "__main__": if __name__ == "__main__":
new(["scratchpad"], ()) # BUG: fix this bug where input tokens are mismatched
new(["meeting", "robs presentation", "meeting on gcp"])
# new(["meeting", "robs presentation"])