azdo-cli 0.22.0-develop.764 → 0.22.0-feature-046-config-help.765
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.
|
@@ -49,45 +49,56 @@ function parseCredentialStore(value, platform = process.platform) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// src/services/config-store.ts
|
|
52
|
+
var CREDENTIAL_STORE_NOTES = {
|
|
53
|
+
keyring: "OS vault, default",
|
|
54
|
+
dpapi: "Windows only; DPAPI-encrypted files under ~/.azdo/credentials"
|
|
55
|
+
};
|
|
52
56
|
var SETTINGS = [
|
|
53
57
|
{
|
|
54
58
|
key: "org",
|
|
55
59
|
description: "Azure DevOps organization name",
|
|
56
60
|
type: "string",
|
|
57
61
|
example: "mycompany",
|
|
58
|
-
required: true
|
|
62
|
+
required: true,
|
|
63
|
+
scoped: false
|
|
59
64
|
},
|
|
60
65
|
{
|
|
61
66
|
key: "project",
|
|
62
67
|
description: "Azure DevOps project name",
|
|
63
68
|
type: "string",
|
|
64
69
|
example: "MyProject",
|
|
65
|
-
required: true
|
|
70
|
+
required: true,
|
|
71
|
+
scoped: true
|
|
66
72
|
},
|
|
67
73
|
{
|
|
68
74
|
key: "fields",
|
|
69
75
|
description: "Extra work item fields to include (comma-separated reference names)",
|
|
70
76
|
type: "string[]",
|
|
71
77
|
example: "System.Tags,Custom.Priority",
|
|
72
|
-
required: false
|
|
78
|
+
required: false,
|
|
79
|
+
scoped: true
|
|
73
80
|
},
|
|
74
81
|
{
|
|
75
82
|
key: "markdown",
|
|
76
83
|
description: "Convert rich text fields to markdown on display",
|
|
77
84
|
type: "boolean",
|
|
78
85
|
example: "true",
|
|
79
|
-
required: false
|
|
86
|
+
required: false,
|
|
87
|
+
scoped: true
|
|
80
88
|
},
|
|
81
89
|
{
|
|
82
90
|
key: "credentialStore",
|
|
83
|
-
description:
|
|
91
|
+
description: "Where credentials are stored (keyring or dpapi)",
|
|
84
92
|
type: "string",
|
|
85
93
|
example: "dpapi",
|
|
86
|
-
required: false
|
|
94
|
+
required: false,
|
|
95
|
+
scoped: false,
|
|
96
|
+
values: CREDENTIAL_STORES.map((value) => ({ value, note: CREDENTIAL_STORE_NOTES[value] })),
|
|
97
|
+
env: "AZDO_CREDENTIAL_STORE"
|
|
87
98
|
}
|
|
88
99
|
];
|
|
89
100
|
var VALID_KEYS = SETTINGS.map((s) => s.key);
|
|
90
|
-
var SCOPED_KEYS =
|
|
101
|
+
var SCOPED_KEYS = SETTINGS.filter((s) => s.scoped).map((s) => s.key);
|
|
91
102
|
function getConfigPath() {
|
|
92
103
|
return path.join(os.homedir(), ".azdo", "config.json");
|
|
93
104
|
}
|
|
@@ -1178,7 +1189,7 @@ async function deletePat(org) {
|
|
|
1178
1189
|
}
|
|
1179
1190
|
try {
|
|
1180
1191
|
const { unlinkSync: unlinkSync2 } = await import("fs");
|
|
1181
|
-
const { lockPath: lockPath2 } = await import("./oauth-token-refresh-
|
|
1192
|
+
const { lockPath: lockPath2 } = await import("./oauth-token-refresh-QPPOTES2.js");
|
|
1182
1193
|
unlinkSync2(lockPath2(org));
|
|
1183
1194
|
} catch {
|
|
1184
1195
|
}
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
tokenResponseToCredential,
|
|
40
40
|
unsetConfigValue,
|
|
41
41
|
unsetOrgScopedValue
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-MHJ6OBX3.js";
|
|
43
43
|
|
|
44
44
|
// src/program.ts
|
|
45
45
|
import { Command as Command19 } from "commander";
|
|
@@ -2777,9 +2777,41 @@ async function promptForSetting(cfg, setting, ask) {
|
|
|
2777
2777
|
|
|
2778
2778
|
`);
|
|
2779
2779
|
}
|
|
2780
|
+
var SETTING_TYPE_LABEL = {
|
|
2781
|
+
string: "string",
|
|
2782
|
+
"string[]": "comma-separated list",
|
|
2783
|
+
boolean: "true | false"
|
|
2784
|
+
};
|
|
2785
|
+
function describeSettingValues(setting) {
|
|
2786
|
+
if (!setting.values) return `type: ${SETTING_TYPE_LABEL[setting.type]}`;
|
|
2787
|
+
const list = setting.values.map((v) => v.note ? `${v.value} (${v.note})` : v.value).join(", ");
|
|
2788
|
+
return `values: ${list}`;
|
|
2789
|
+
}
|
|
2790
|
+
function renderSettingsHelp(settings = SETTINGS) {
|
|
2791
|
+
const keyWidth = Math.max(...settings.map((s) => s.key.length)) + 3;
|
|
2792
|
+
const indent = " ".repeat(2 + keyWidth);
|
|
2793
|
+
const lines = ["Settings (azdo config set <key> <value>):", ""];
|
|
2794
|
+
for (const setting of settings) {
|
|
2795
|
+
const facts = [
|
|
2796
|
+
describeSettingValues(setting),
|
|
2797
|
+
`scope: ${setting.scoped ? "global, or per organization with --org <org>" : "global only"}`
|
|
2798
|
+
];
|
|
2799
|
+
if (setting.required) facts.push("required");
|
|
2800
|
+
if (setting.env) facts.push(`env: ${setting.env} overrides the stored value`);
|
|
2801
|
+
lines.push(` ${setting.key.padEnd(keyWidth)}${setting.description}`);
|
|
2802
|
+
for (const fact of facts) lines.push(`${indent}${fact}`);
|
|
2803
|
+
lines.push(`${indent}example: azdo config set ${setting.key} ${setting.example}`);
|
|
2804
|
+
lines.push("");
|
|
2805
|
+
}
|
|
2806
|
+
return lines.join("\n").trimEnd();
|
|
2807
|
+
}
|
|
2808
|
+
var KEY_ARGUMENT_HELP = `setting key (${SETTINGS.map((s) => s.key).join(", ")})`;
|
|
2809
|
+
var KEY_HELP_POINTER = "\nRun `azdo config --help` for each setting's meaning, accepted values and scope.\n";
|
|
2780
2810
|
function createConfigCommand() {
|
|
2781
2811
|
const config = new Command4("config");
|
|
2782
2812
|
config.description("Manage CLI settings");
|
|
2813
|
+
config.addHelpText("after", `
|
|
2814
|
+
${renderSettingsHelp()}`);
|
|
2783
2815
|
config.addHelpText(
|
|
2784
2816
|
"after",
|
|
2785
2817
|
[
|
|
@@ -2797,7 +2829,7 @@ function createConfigCommand() {
|
|
|
2797
2829
|
].join("\n")
|
|
2798
2830
|
);
|
|
2799
2831
|
const set = new Command4("set");
|
|
2800
|
-
set.description("Set a configuration value").argument("<key>",
|
|
2832
|
+
set.description("Set a configuration value").argument("<key>", KEY_ARGUMENT_HELP).argument("<value>", "setting value").option("--org <org>", "set value in an org-scoped configuration").option("--json", "output in JSON format").option("--copy-credentials", "with credentialStore dpapi: copy Credential Manager credentials without asking").option("--no-copy-credentials", "with credentialStore dpapi: do not offer to copy Credential Manager credentials").addHelpText("after", KEY_HELP_POINTER).action((key, value, options) => {
|
|
2801
2833
|
try {
|
|
2802
2834
|
if (options.org) {
|
|
2803
2835
|
setOrgScopedValue(options.org, key, value);
|
|
@@ -2831,7 +2863,7 @@ function createConfigCommand() {
|
|
|
2831
2863
|
writeJson();
|
|
2832
2864
|
});
|
|
2833
2865
|
const get = new Command4("get");
|
|
2834
|
-
get.description("Get a configuration value").argument("<key>",
|
|
2866
|
+
get.description("Get a configuration value").argument("<key>", KEY_ARGUMENT_HELP).option("--org <org>", "read from an org-scoped configuration").option("--json", "output in JSON format").addHelpText("after", KEY_HELP_POINTER).action((key, options) => {
|
|
2835
2867
|
try {
|
|
2836
2868
|
const value = options.org ? getOrgScopedValue(options.org, key) : getConfigValue(key);
|
|
2837
2869
|
if (options.json) {
|
|
@@ -2864,7 +2896,7 @@ function createConfigCommand() {
|
|
|
2864
2896
|
writeConfigList(cfg);
|
|
2865
2897
|
});
|
|
2866
2898
|
const unset = new Command4("unset");
|
|
2867
|
-
unset.description("Remove a configuration value").argument("<key>",
|
|
2899
|
+
unset.description("Remove a configuration value").argument("<key>", KEY_ARGUMENT_HELP).option("--org <org>", "remove from an org-scoped configuration").option("--json", "output in JSON format").addHelpText("after", KEY_HELP_POINTER).action((key, options) => {
|
|
2868
2900
|
try {
|
|
2869
2901
|
if (options.org) {
|
|
2870
2902
|
unsetOrgScopedValue(options.org, key);
|