Skip to content

Commit

Permalink
fix: e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 committed Apr 23, 2024
1 parent 2eb8f7a commit 01f4c3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
import {
API_KEY_PAK_PREFIX,
API_KEY_PAT_PREFIX,
DEFAULT_API_URL,
VERSION,
} from './constants.js';

Expand Down Expand Up @@ -179,9 +180,9 @@ async function run() {

// Global options
program.addOption(CONFIG_OPT);
program.addOption(API_URL_OPT.default(config.apiUrl));
program.addOption(API_URL_OPT.default(config.apiUrl ?? DEFAULT_API_URL));
program.addOption(API_KEY_OPT.default(config.apiKey));
program.addOption(PROJECT_ID_OPT.default(config.projectId));
program.addOption(PROJECT_ID_OPT.default(config.projectId ?? -1));

// Register commands
program.addCommand(Login);
Expand Down
9 changes: 2 additions & 7 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type Client from './client/index.js';
import { existsSync } from 'fs';
import { resolve } from 'path';
import { Option, InvalidArgumentError } from 'commander';
import { DEFAULT_API_URL } from './constants.js';

function parseProjectId(v: string) {
const val = Number(v);
Expand Down Expand Up @@ -44,16 +43,12 @@ export const API_KEY_OPT = new Option(
export const PROJECT_ID_OPT = new Option(
'-p, --project-id <id>',
'Project ID. Only required when using a Personal Access Token.'
)
.default(-1)
.argParser(parseProjectId);
).argParser(parseProjectId);

export const API_URL_OPT = new Option(
'-au, --api-url <url>',
'The url of Tolgee API.'
)
.default(DEFAULT_API_URL)
.argParser(parseUrlArgument);
).argParser(parseUrlArgument);

export const EXTRACTOR = new Option(
'-e, --extractor <extractor>',
Expand Down

0 comments on commit 01f4c3b

Please sign in to comment.