Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 64c4feb

Browse files
feat: display config path in token commands
1 parent 51d9f3e commit 64c4feb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/codigaToken.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
printSuccess,
1010
printCommandSuggestion,
1111
} from "../utils/print";
12-
import { setToken, getToken, deleteToken } from "../utils/store";
12+
import { setToken, getToken, deleteToken, store } from "../utils/store";
1313

1414
/**
1515
* Returns the user details for a valid API token
@@ -41,13 +41,15 @@ export async function checkCodigaToken() {
4141
printSuccess(
4242
`A valid API token was found for ${user.username} (${user.accountType})`
4343
);
44+
printSuggestion(`Tokens can be found here:`, store.path);
4445
printCommandSuggestion(
4546
" ↳ If you wish to override it, run one of the following commands:",
4647
ACTION_TOKEN_ADD
4748
);
4849
process.exit(0);
4950
} else {
5051
printInfo("An invalid token was found");
52+
printSuggestion(`Tokens can be found here:`, store.path);
5153
printCommandSuggestion(
5254
" ↳ To override it, run one of the following commands:",
5355
ACTION_TOKEN_ADD
@@ -88,6 +90,7 @@ export async function addCodigaToken() {
8890
printSuccess(
8991
`Codiga API token added for ${user.username} (${user.accountType})`
9092
);
93+
printSuggestion(`Tokens can be found here:`, store.path);
9194
process.exit(0);
9295
} else {
9396
printFailure("That token is not valid");
@@ -114,13 +117,15 @@ export async function deleteCodigaToken() {
114117
// ensure the token was deleted
115118
if (getToken()) {
116119
printFailure("We couldn't delete your Codiga API token");
120+
printSuggestion(`Tokens can be found here:`, store.path);
117121
printSuggestion(
118122
" ↳ If the issue persists, contact us at:",
119123
"https://app.codiga.io/support"
120124
);
121125
process.exit(1);
122126
} else {
123127
printSuccess("Codiga API token deleted");
128+
printSuggestion(`Tokens can be found here:`, store.path);
124129
printCommandSuggestion(
125130
" ↳ To set a Codiga API token, run one of the following commands:",
126131
ACTION_TOKEN_ADD

0 commit comments

Comments
 (0)