@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.
- package/dist/commands/ls.js +8 -6
- package/dist/commands/ssh.d.ts +1 -0
- package/dist/commands/ssh.js +5 -0
- package/package.json +1 -1
package/dist/commands/ls.js
CHANGED
|
@@ -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
|
|
65
|
-
const
|
|
66
|
-
|
|
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
|
-
|
|
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 {
|
package/dist/commands/ssh.d.ts
CHANGED
package/dist/commands/ssh.js
CHANGED
|
@@ -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");
|