Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from "axios";
import { program } from "commander";
import { program, Option } from "commander";
import {
ExecuteTestsOptions,
GetTestReportOptions,
Expand Down Expand Up @@ -82,6 +82,7 @@
},
},
environmentName: options.environment,
tags: options.tags,
};

const response = await apiCall<TestReportResponse>(
Expand Down Expand Up @@ -348,18 +349,20 @@
console.log("Environment deleted successfully!");
}

const apiKeyOption = new Option("-k, --api-key <key>", "the api key for authentication").env("API_KEY").makeOptionMandatory();

Check warning on line 352 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Linting

Replace `"-k,·--api-key·<key>",·"the·api·key·for·authentication").env("API_KEY")` with `⏎··"-k,·--api-key·<key>",⏎··"the·api·key·for·authentication",⏎)⏎··.env("API_KEY")⏎··`

function createCommandWithCommonOptions(command: string) {
return program
.command(command)
.requiredOption("-k, --api-key <key>", "Octomind API key")
.addOption(apiKeyOption)
.option("-j, --json", "Output raw JSON response");
}

export function run() {
// CLI program setup
program
.name("octomind-cli")
.description(
.description(

Check warning on line 365 in src/cli.ts

View workflow job for this annotation

GitHub Actions / Linting

Delete `··`
"Octomind CLI tool. see https://octomind.dev/docs/api-reference/",
);

Expand All @@ -369,6 +372,7 @@
.requiredOption("-u, --url <url>", "URL to test")
.option("-e, --environment <name>", "Environment name", "default")
.option("-d, --description <text>", "Test description")
.option("-g --tags <tags>", "comma separated list of tags")
.action(executeTests);

createCommandWithCommonOptions("report")
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface TestTargetExecutionRequest {
url: string;
context: ExecutionContext;
environmentName?: string;
tags?: string[];
}

export interface TestResult {
Expand Down Expand Up @@ -66,6 +67,7 @@ export interface ExecuteTestsOptions {
environment?: string;
description?: string;
json?: boolean;
tags?: string[];
}

export interface GetTestReportOptions {
Expand Down
Loading