Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion integration-tests/formating/formatting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,29 @@ describe('Command formatting tests', async () => {
expect(flag, `Flag '${flagName}' in command '${command.cmd.id}' is missing the 'required' property`).to.have.property('required');

if(flag.type === 'option') {
console.log(flag);
expect(flag, `Flag '${flagName}' in command '${command.cmd.id}' is missing a valid 'helpValue'`).to.have.property('helpValue').to.be.a('string').and.not.be.empty;
}
}
}
});

it('Should ensure all itwin-id flags have env properties', async () => {
for (const command of allCommands) {
const iTwinIdFlag = command.flags.find(([name, _]) => name === "itwin-id");
if (iTwinIdFlag) {
expect(iTwinIdFlag[1].env, `Flag 'itwin-id' in command '${command.cmd.id}' is missing the 'env' property`).to.be.a('string').and.be.equals("ITP_ITWIN_ID");
}
}
});

it('Should ensure all imodel-id flags have env properties', async () => {
for (const command of allCommands) {
const iTwinIdFlag = command.flags.find(([name, _]) => name === "imodel-id");
if (iTwinIdFlag) {
expect(iTwinIdFlag[1].env, `Flag 'imodel-id' in command '${command.cmd.id}' is missing the 'env' property`).to.be.a('string').and.be.equals("ITP_IMODEL_ID");
}
}
});
});

type CommandWithFlags = {
Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/group/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Flags } from "@oclif/core";

import { apiReference } from "../../../extensions/api-reference.js";
import BaseCommand from "../../../extensions/base-command.js";
import { CustomFlags } from "../../../extensions/custom-flags.js";

export default class CreateAccessControlGroup extends BaseCommand {
static apiReference : apiReference = {
Expand All @@ -30,11 +31,8 @@ export default class CreateAccessControlGroup extends BaseCommand {
helpValue: '<string>',
required: true,
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin where the group is being created.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin where the group is being created.'
}),
name: Flags.string({
char: 'n',
Expand Down
6 changes: 2 additions & 4 deletions src/commands/access-control/group/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../extensions/base-command.js";
import { CustomFlags } from "../../../extensions/custom-flags.js";

export default class DeleteAccessControlGroup extends BaseCommand {
static description = 'Delete an existing group from an iTwin.';
Expand All @@ -24,11 +25,8 @@ export default class DeleteAccessControlGroup extends BaseCommand {
helpValue: '<string>',
required: true,
}),
"itwin-id": Flags.string({
char: 'i',
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin where the group exists.',
helpValue: '<string>',
required: true,
}),
};

Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/group/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../extensions/base-command.js";
import { CustomFlags } from "../../../extensions/custom-flags.js";

export default class AccessControlGroupInfo extends BaseCommand {
static description = 'Retrieve details about a specific group in an iTwin.';
Expand All @@ -24,11 +25,8 @@ export default class AccessControlGroupInfo extends BaseCommand {
helpValue: '<string>',
required: true,
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin where the group exists.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin where the group exists.'
}),
};

Expand Down
10 changes: 3 additions & 7 deletions src/commands/access-control/group/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { Flags } from "@oclif/core";

import BaseCommand from "../../../extensions/base-command.js";
import { CustomFlags } from "../../../extensions/custom-flags.js";

export default class ListAccessControlGroups extends BaseCommand {
static description = 'List all groups for a specific iTwin.';
Expand All @@ -18,11 +17,8 @@ export default class ListAccessControlGroups extends BaseCommand {
];

static flags = {
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin whose groups you want to list.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin whose groups you want to list.'
}),
};

Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/group/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../extensions/base-command.js";
import { CustomFlags } from "../../../extensions/custom-flags.js";

export default class UpdateAccessControlGroup extends BaseCommand {
static description = 'Update the details of an existing group in an iTwin.';
Expand Down Expand Up @@ -38,11 +39,8 @@ export default class UpdateAccessControlGroup extends BaseCommand {
helpValue: '<string>',
multiple: true,
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin where the group exists.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin where the group exists.'
}),
member: Flags.string({
description: 'A list of members (emails) to be assigned to the group.',
Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/member/group/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";
import { GroupMember } from "../../../../services/access-control-client/models/group.js";

export default class AddGroupMembers extends BaseCommand {
Expand All @@ -24,11 +25,8 @@ export default class AddGroupMembers extends BaseCommand {
helpValue: '<string>',
required: true
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin to which the groups will be added.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin to which the groups will be added.'
}),
};

Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/member/group/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";

export default class DeleteGroupMember extends BaseCommand {
static description = 'Remove a group from an iTwin.';
Expand All @@ -24,11 +25,8 @@ export default class DeleteGroupMember extends BaseCommand {
helpValue: '<string>',
required: true,
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin where the group is a member.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin where the group is a member.'
}),
};

Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/member/group/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";

export default class InfoGroupMember extends BaseCommand {
static description = 'Retrieve details about a specific group member in an iTwin.';
Expand All @@ -24,11 +25,8 @@ export default class InfoGroupMember extends BaseCommand {
helpValue: '<string>',
required: true,
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin where the group is a member.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin where the group is a member.'
}),
};

Expand Down
8 changes: 2 additions & 6 deletions src/commands/access-control/member/group/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";

export default class ListGroupMembers extends BaseCommand {
static description = 'List all group members of an iTwin.';
Expand All @@ -18,11 +17,8 @@ export default class ListGroupMembers extends BaseCommand {
];

static flags = {
"itwin-id": Flags.string({
char: 'i',
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin whose group members you want to list.',
helpValue: '<string>',
required: true,
}),
};

Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/member/group/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";

export default class UpdateGroupMember extends BaseCommand {
static description = 'Update the role assignments for a group in an iTwin.';
Expand All @@ -24,11 +25,8 @@ export default class UpdateGroupMember extends BaseCommand {
helpValue: '<string>',
required: true,
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin to which the groups will be added.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin to which the groups will be added.'
}),
"role-id": Flags.string({
description: 'A list of role IDs to assign to the group.',
Expand Down
8 changes: 2 additions & 6 deletions src/commands/access-control/member/invitations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { Flags } from "@oclif/core";

import BaseCommand from "../../../extensions/base-command.js";
import { CustomFlags } from "../../../extensions/custom-flags.js";

export default class AccessControlMemberInvitations extends BaseCommand {
static description = "Retrieve the list of pending invitations for an iTwin's members.";
Expand All @@ -18,11 +17,8 @@ export default class AccessControlMemberInvitations extends BaseCommand {
];

static flags = {
"itwin-id": Flags.string({
char: 'i',
"itwin-id": CustomFlags.iTwinIDFlag({
description: "The ID of the iTwin whose member invitations you want to retrieve.",
helpValue: '<string>',
required: true,
}),
};

Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/member/owner/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";

export default class AddOwner extends BaseCommand {
static description = 'Add a new owner to an iTwin by email.';
Expand All @@ -23,11 +24,8 @@ export default class AddOwner extends BaseCommand {
helpValue: '<string>',
required: true,
}),
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin to which the owner will be added.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin to which the owner will be added.'
}),
};

Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/member/owner/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";

export default class DeleteOwner extends BaseCommand {
static description = 'Remove an owner from an iTwin by their member ID.';
Expand All @@ -18,11 +19,8 @@ export default class DeleteOwner extends BaseCommand {
];

static flags = {
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin from which the owner will be removed.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin from which the owner will be removed.'
}),
"member-id": Flags.string({
description: 'The ID of the owner to be removed.',
Expand Down
8 changes: 2 additions & 6 deletions src/commands/access-control/member/owner/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";

export default class ListOwners extends BaseCommand {
static description = 'List all owners of a specific iTwin.';
Expand All @@ -18,11 +17,8 @@ export default class ListOwners extends BaseCommand {
];

static flags = {
"itwin-id": Flags.string({
char: 'i',
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin whose owners you want to list.',
helpValue: '<string>',
required: true,
}),
};

Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/member/user/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";
import { addMember } from "../../../../services/access-control-client/models/members.js";

export default class AddUserMembers extends BaseCommand {
Expand All @@ -19,11 +20,8 @@ export default class AddUserMembers extends BaseCommand {
];

static flags = {
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin to which the users will be added.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin to which the users will be added.'
}),
members: Flags.string({
description: 'A list of members to add, each with an email and a list of role IDs.',
Expand Down
8 changes: 3 additions & 5 deletions src/commands/access-control/member/user/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { Flags } from "@oclif/core";

import BaseCommand from "../../../../extensions/base-command.js";
import { CustomFlags } from "../../../../extensions/custom-flags.js";

export default class DeleteUserMember extends BaseCommand {
static description = 'Remove a user from an iTwin.';
Expand All @@ -18,11 +19,8 @@ export default class DeleteUserMember extends BaseCommand {
];

static flags = {
"itwin-id": Flags.string({
char: 'i',
description: 'The ID of the iTwin where the user is a member.',
helpValue: '<string>',
required: true,
"itwin-id": CustomFlags.iTwinIDFlag({
description: 'The ID of the iTwin where the user is a member.'
}),
"member-id": Flags.string({
description: 'The ID of the user to remove from the iTwin.',
Expand Down
Loading
Loading