@p0security/cli 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,16 +60,18 @@ const ls = (args) => __awaiter(void 0, void 0, void 0, function* () {
60
60
  ? ` (use \`p0
61
61
  ${allArguments.join(" ")} <like>\` to narrow results)`
62
62
  : "";
63
- (0, stdio_1.print2)(`Showing${truncationPart} ${label}${postfixPart}:`);
64
- const isSameValue = data.items.every((i) => !i.group && i.key === i.value);
65
- const maxLength = (0, lodash_1.max)(data.items.map((i) => i.key.length)) || 0;
66
- for (const item of data.items) {
63
+ (0, stdio_1.print2)(`Showing${truncationPart} ${label}${postfixPart}. Resources labeled with * are already accessible to you:`);
64
+ const sortedItems = (0, lodash_1.orderBy)(data.items, "isPreexisting", "desc");
65
+ const isSameValue = sortedItems.every((i) => !i.group && i.key === i.value);
66
+ const maxLength = (0, lodash_1.max)(sortedItems.map((i) => i.key.length)) || 0;
67
+ for (const item of sortedItems) {
67
68
  const tagPart = `${item.group ? `${item.group} / ` : ""}${item.value}`;
68
- (0, stdio_1.print1)(isSameValue
69
+ const prefix = item.isPreexisting ? "* " : " ";
70
+ (0, stdio_1.print1)(`${prefix}${isSameValue
69
71
  ? item.key
70
72
  : maxLength > 30
71
73
  ? `${item.key}\n ${stdio_1.Ansi.Dim}${tagPart}${stdio_1.Ansi.Reset}`
72
- : `${item.key.padEnd(maxLength)}${stdio_1.Ansi.Dim} - ${tagPart}${stdio_1.Ansi.Reset}`);
74
+ : `${item.key.padEnd(maxLength)}${stdio_1.Ansi.Dim} - ${tagPart}${stdio_1.Ansi.Reset}`}`);
73
75
  }
74
76
  }
75
77
  else {
@@ -7,5 +7,6 @@ export declare type SshCommandArgs = {
7
7
  arguments: string[];
8
8
  sudo?: boolean;
9
9
  reason?: string;
10
+ account?: string;
10
11
  };
11
12
  export declare const sshCommand: (yargs: yargs.Argv<{}>) => yargs.Argv<SshCommandArgs>;
@@ -73,6 +73,10 @@ const sshCommand = (yargs) => yargs.command("ssh <destination> [command [argumen
73
73
  .option("reason", {
74
74
  describe: "Reason access is needed",
75
75
  type: "string",
76
+ })
77
+ .option("account", {
78
+ type: "string",
79
+ describe: "The account on which the instance is located",
76
80
  }), (0, firestore_1.guard)(ssh));
77
81
  exports.sshCommand = sshCommand;
78
82
  const validateSshInstall = (authn) => __awaiter(void 0, void 0, void 0, function* () {
@@ -141,6 +145,7 @@ const ssh = (args) => __awaiter(void 0, void 0, void 0, function* () {
141
145
  "aws",
142
146
  ...(args.sudo || args.command === "sudo" ? ["--sudo"] : []),
143
147
  ...(args.reason ? ["--reason", args.reason] : []),
148
+ ...(args.account ? ["--account", args.account] : []),
144
149
  ], wait: true }), authn, { message: "approval-required" });
145
150
  if (!response) {
146
151
  (0, stdio_1.print2)("Did not receive access ID from server");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@p0security/cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Execute infra CLI commands with P0 grants",
5
5
  "main": "index.ts",
6
6
  "repository": {