Skip to content

Commit

Permalink
fixup! feat: function inspect all
Browse files Browse the repository at this point in the history
  • Loading branch information
danewalters committed Sep 11, 2024
1 parent be3e333 commit 4dbfd19
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/subcommands/function/inspect/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ export default async function (options: InspectOptions, functionName?: string) {
projectId,
environmentName,
functionName: name,
}).then((deployment) => {
if (!deployment) api.console.log(`Function ${name} not found.`);
return buildDeploymentTable(deployment!, name, environmentName);
})
}).then((
deployment,
) => (buildDeploymentTable(deployment!, name, environmentName)))
);
const deploymentTables = await Promise.all(deploymentPromises);

Expand All @@ -44,10 +43,15 @@ export default async function (options: InspectOptions, functionName?: string) {
}

function buildDeploymentTable(
deployment: Deployment,
deployment: Deployment | undefined,
functionName: string,
environmentName: ProjectEnvironmentName,
) {
if (!deployment) {
api.console.log(`Function ${functionName} not found.`);
return Table.from([]);
}

return Table.from([
["Environment", environmentName],
["Function Name", functionName],
Expand All @@ -63,7 +67,7 @@ function coloredDeploymentState(state: DeploymentState): string {
"RUNNING": colors.green,
"BOOT_FAILED": colors.red,
"DESTROYED": colors.magenta,
"EARLY_EXITED": colors.yellow,
"EARLY_EXITED": colors.red,
"UNCAUGHT_EXCEPTION": colors.red,
"MEMORY_LIMIT_EXCEEDED": colors.red,
};
Expand Down

0 comments on commit 4dbfd19

Please sign in to comment.