@argos-ci/cli 6.0.0 → 6.1.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +19 -0
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -132,6 +132,13 @@ function formatUser(user) {
132
132
  if (!user) return "-";
133
133
  return user.name ? `${user.name} (@${user.slug})` : `@${user.slug}`;
134
134
  }
135
+ function formatMe(user) {
136
+ return [
137
+ `Logged in to Argos as ${formatUser(user)}.`,
138
+ `Slug: ${user.slug}`,
139
+ `Name: ${formatValue(user.name)}`
140
+ ].join("\n");
141
+ }
135
142
  function formatStats(stats) {
136
143
  if (!stats) return "-";
137
144
  return [
@@ -1074,6 +1081,17 @@ function deployCommand(program) {
1074
1081
  });
1075
1082
  }
1076
1083
  //#endregion
1084
+ //#region src/commands/whoami.ts
1085
+ function whoamiCommand(program) {
1086
+ program.command("whoami").description("Display the user authenticated with the current Argos token").addOption(tokenOption).addOption(jsonOption).action(async (options) => {
1087
+ try {
1088
+ output(unwrap(await createApiClient(await resolveToken(options)).GET("/me")), options, formatMe);
1089
+ } catch (error) {
1090
+ handleCliError(error, "user");
1091
+ }
1092
+ });
1093
+ }
1094
+ //#endregion
1077
1095
  //#region src/index.ts
1078
1096
  const rawPkg = await readFile(resolve(fileURLToPath(new URL(".", import.meta.url)), "..", "package.json"), "utf8");
1079
1097
  const pkg = JSON.parse(rawPkg);
@@ -1087,6 +1105,7 @@ commentCommand(program);
1087
1105
  loginCommand(program);
1088
1106
  logoutCommand(program);
1089
1107
  deployCommand(program);
1108
+ whoamiCommand(program);
1090
1109
  if (!process.argv.slice(2).length) program.outputHelp();
1091
1110
  else program.parse(process.argv);
1092
1111
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/cli",
3
3
  "description": "Command-line (CLI) for visual testing with Argos.",
4
- "version": "6.0.0",
4
+ "version": "6.1.0",
5
5
  "bin": {
6
6
  "argos": "./bin/argos-cli.js"
7
7
  },
@@ -34,8 +34,8 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@argos-ci/api-client": "0.23.0",
38
- "@argos-ci/core": "6.3.0",
37
+ "@argos-ci/api-client": "0.24.0",
38
+ "@argos-ci/core": "6.4.0",
39
39
  "commander": "^15.0.0",
40
40
  "open": "^11.0.0",
41
41
  "ora": "^9.4.0",
@@ -54,5 +54,5 @@
54
54
  "check-format": "prettier --check --ignore-unknown --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
55
55
  "lint": "eslint ."
56
56
  },
57
- "gitHead": "a2fb6e1a811e66f3839293ea5a71e93fee838aac"
57
+ "gitHead": "ee2e5d3c14c83e07dfffa14ddc9f34f934f8c368"
58
58
  }