@newlandnpt/pep-cli 0.1.0 → 0.1.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/pep.cjs +20 -11
- package/package.json +1 -1
package/dist/pep.cjs
CHANGED
|
@@ -21,8 +21,8 @@ function issuerForEnvironment(environment) {
|
|
|
21
21
|
}
|
|
22
22
|
var BUILD_ENVIRONMENT = false ? "development" : "production";
|
|
23
23
|
var DEFAULT_ISSUER = issuerForEnvironment(BUILD_ENVIRONMENT);
|
|
24
|
-
function configuredIssuer(explicitIssuer
|
|
25
|
-
return explicitIssuer ??
|
|
24
|
+
function configuredIssuer(explicitIssuer) {
|
|
25
|
+
return explicitIssuer ?? DEFAULT_ISSUER;
|
|
26
26
|
}
|
|
27
27
|
function configDirectory() {
|
|
28
28
|
if (process.platform === "win32") return (0, import_node_path.join)((0, import_node_os.homedir)(), "AppData", "Roaming", "PEP");
|
|
@@ -936,7 +936,7 @@ async function syncSkills(dependencies) {
|
|
|
936
936
|
}
|
|
937
937
|
|
|
938
938
|
// src/cli.ts
|
|
939
|
-
var VERSION = "0.1.
|
|
939
|
+
var VERSION = "0.1.1";
|
|
940
940
|
function usage() {
|
|
941
941
|
return `PEP CLI ${VERSION}
|
|
942
942
|
|
|
@@ -949,7 +949,8 @@ Usage:
|
|
|
949
949
|
pep docs list [--docs-url <url>]
|
|
950
950
|
pep docs get <path> [--docs-url <url>]
|
|
951
951
|
|
|
952
|
-
The issuer is built into this executable.
|
|
952
|
+
The issuer is built into this executable. --issuer overrides it for that one command and is
|
|
953
|
+
NOT remembered \u2014 pass it every time you log in against a non-default deployment.
|
|
953
954
|
--resource names which resource server the token is for (RFC 8707); repeat it for more than
|
|
954
955
|
one. It defaults to the docs platform \u2014 a token minted without it is rejected by every
|
|
955
956
|
resource server, and their answer looks exactly like "this token does not exist".
|
|
@@ -982,15 +983,21 @@ function option(args, name) {
|
|
|
982
983
|
args.splice(index, 2);
|
|
983
984
|
return value;
|
|
984
985
|
}
|
|
985
|
-
async function loginConfig(args) {
|
|
986
|
-
const
|
|
987
|
-
const
|
|
988
|
-
const issuer = configuredIssuer(option(args, "--issuer"), saved?.issuer);
|
|
989
|
-
const clientId = option(args, "--client-id") ?? saved?.clientId ?? DEFAULT_CLIENT_ID;
|
|
986
|
+
async function loginConfig(args, store = fileConfigStore()) {
|
|
987
|
+
const issuer = configuredIssuer(option(args, "--issuer"));
|
|
988
|
+
const clientId = option(args, "--client-id") ?? DEFAULT_CLIENT_ID;
|
|
990
989
|
const explicit = repeatedOption(args, "--resource");
|
|
991
|
-
const resources = explicit.length > 0 ? explicit :
|
|
990
|
+
const resources = explicit.length > 0 ? explicit : [...DEFAULT_RESOURCES];
|
|
992
991
|
if (args.length > 0) throw new Error(`Unknown option: ${args[0]}`);
|
|
993
|
-
|
|
992
|
+
const saved = await store.read();
|
|
993
|
+
return {
|
|
994
|
+
version: 1,
|
|
995
|
+
issuer,
|
|
996
|
+
clientId,
|
|
997
|
+
redirectUri: DEFAULT_REDIRECT_URI,
|
|
998
|
+
resources,
|
|
999
|
+
...saved?.docsUrl !== void 0 ? { docsUrl: saved.docsUrl } : {}
|
|
1000
|
+
};
|
|
994
1001
|
}
|
|
995
1002
|
async function main() {
|
|
996
1003
|
const args = process.argv.slice(2);
|
|
@@ -1113,6 +1120,8 @@ ${url}`)
|
|
|
1113
1120
|
|
|
1114
1121
|
${usage()}`);
|
|
1115
1122
|
}
|
|
1123
|
+
|
|
1124
|
+
// src/main.ts
|
|
1116
1125
|
main().catch((error) => {
|
|
1117
1126
|
console.error(`pep: ${error.message}`);
|
|
1118
1127
|
process.exitCode = 1;
|