Skip to content

Commit

Permalink
Fix dropping STH by id
Browse files Browse the repository at this point in the history
  • Loading branch information
patuwwy committed Mar 27, 2023
1 parent 82f13c6 commit 4c1277b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/cli/src/lib/commands/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,21 @@ export const space: CommandDefinition = (program) => {
.argument("<space_name>", "The name of the Space")
.option("--id <id>", "Hub Id")
.option("--all", "Disconnects all self-hosted Hubs connected to Space", false)
.action(async (spaceName: string, id: string, all: string) => {
.action(async (spaceName: string, options: { id: string, all: boolean }) => {
const mwClient = getMiddlewareClient();
const managerClient = mwClient.getManagerClient(spaceName);
let opts = { } as PostDisconnectPayload;

if (typeof id === "string") {
opts = { id };
if (typeof options.id === "string") {
opts = { id: options.id };
}

if (all) {
if (options.all) {
opts = { limit: 0 };
}

console.dir({spaceName, opts}, { depth: 2 });

if (!Object.keys(opts).length) {
throw new Error("Missing --id or --all");
}
Expand Down

0 comments on commit 4c1277b

Please sign in to comment.