@tailglow/cli 0.7.1 → 0.8.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/src/index.js CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  renderResourceHelp,
21
21
  renderRootHelp
22
22
  } from "./help.js";
23
+ import { IMPORT_PARSER_OPTIONS } from "./import-options.js";
23
24
  import {
24
25
  createLoginContext,
25
26
  runLoginCommand,
@@ -60,7 +61,11 @@ const LOGIN_PARSER_OPTIONS = {
60
61
  new: { type: "boolean" }
61
62
  };
62
63
 
63
- const PARSER_OPTIONS = { ...LOGIN_PARSER_OPTIONS, ...buildParserOptions(CLI_COMMANDS) };
64
+ const PARSER_OPTIONS = {
65
+ ...LOGIN_PARSER_OPTIONS,
66
+ ...IMPORT_PARSER_OPTIONS,
67
+ ...buildParserOptions(CLI_COMMANDS)
68
+ };
64
69
 
65
70
  /** @param {string[]} argv */
66
71
  export function parseFlags(argv) {
@@ -206,6 +211,10 @@ async function confirmDestructive(command, flags) {
206
211
  */
207
212
  export async function run(argv, login_context = createLoginContext()) {
208
213
  const { values: flags, positionals } = parseFlags(argv);
214
+ if (positionals[0] === "import") {
215
+ const { runImportCommand } = await import("./import-command.js");
216
+ return runImportCommand(argv);
217
+ }
209
218
 
210
219
  try {
211
220
  normalizeSwitches(flags);
@@ -426,7 +435,10 @@ if (isEntrypoint()) {
426
435
  ["login", "logout", "whoami"].includes(positionals[0]) ||
427
436
  (positionals[0] === "config" && ["set", "unset"].includes(positionals[1])));
428
437
  process.exitCode = result.code;
429
- writeCommandResult(result, { json, message });
438
+ if (positionals[0] === "import" && json) {
439
+ // Import reports include partial delivery state, so scripts always receive one stdout JSON document.
440
+ process.stdout.write(result.output + "\n");
441
+ } else writeCommandResult(result, { json, message });
430
442
  } catch (err) {
431
443
  process.exitCode = 1;
432
444
  const message = err instanceof Error ? err.message : String(err);