def apps(): out = Output() config = get_config() if not config.ready: config.load() team = config.get("heroku_team", None) command_runner = HerokuInfo(team=team) my_apps = command_runner.my_apps() my_user = command_runner.login_name() listing = [] header_map = [ {"title": "UID", "id": "dallinger_uid"}, {"title": "Started", "id": "created_at"}, {"title": "URL", "id": "web_url"}, ] headers = [h["title"] for h in header_map] for app in my_apps: app_info = [] for detail in header_map: val = "" key = detail.get("id") if key: val = app.get(key, "") app_info.append(val) listing.append(app_info) if listing: out.log( "Found {} heroku apps running for user {}".format(len(listing), my_user) ) out.log(tabulate.tabulate(listing, headers, tablefmt="psql"), chevrons=False) else: out.log("No heroku apps found for user {}".format(my_user))
def info(self): from dallinger.heroku.tools import HerokuInfo yield HerokuInfo(team="fake team")