orangeslice 2.1.1 → 2.1.2
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/cli.js +21 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -317,6 +317,7 @@ function printHelp() {
|
|
|
317
317
|
console.log(" npx orangeslice");
|
|
318
318
|
console.log(" npx orangeslice login [--force]");
|
|
319
319
|
console.log(" npx orangeslice logout");
|
|
320
|
+
console.log(" npx orangeslice auth <API_KEY>");
|
|
320
321
|
console.log(" npx orangeslice auth status\n");
|
|
321
322
|
}
|
|
322
323
|
async function runLogin(args) {
|
|
@@ -335,6 +336,15 @@ function runLogout() {
|
|
|
335
336
|
console.log(" Note: ORANGESLICE_API_KEY env var is still set in this shell.");
|
|
336
337
|
}
|
|
337
338
|
}
|
|
339
|
+
function runAuthSet(apiKey) {
|
|
340
|
+
const trimmed = apiKey.trim();
|
|
341
|
+
if (!trimmed) {
|
|
342
|
+
console.log(" Usage: npx orangeslice auth <API_KEY>");
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
saveConfigFile({ apiKey: trimmed });
|
|
346
|
+
console.log(` ✓ API key saved to ${CONFIG_PATH} (${maskKey(trimmed)})`);
|
|
347
|
+
}
|
|
338
348
|
function runAuthStatus() {
|
|
339
349
|
const envKey = process.env.ORANGESLICE_API_KEY?.trim() || "";
|
|
340
350
|
if (envKey) {
|
|
@@ -359,8 +369,17 @@ async function main() {
|
|
|
359
369
|
runLogout();
|
|
360
370
|
return;
|
|
361
371
|
}
|
|
362
|
-
if (command === "auth"
|
|
363
|
-
|
|
372
|
+
if (command === "auth") {
|
|
373
|
+
const subcommand = args[1];
|
|
374
|
+
if (subcommand === "status") {
|
|
375
|
+
runAuthStatus();
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
if (subcommand && subcommand !== "--help" && subcommand !== "-h") {
|
|
379
|
+
runAuthSet(subcommand);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
printHelp();
|
|
364
383
|
return;
|
|
365
384
|
}
|
|
366
385
|
if (command && (command === "--help" || command === "-h" || command === "help")) {
|