use splashcat exporter when set using cli flags
parent
cb0df39102
commit
94fb731fe0
24
src/app.ts
24
src/app.ts
|
|
@ -9,6 +9,7 @@ import { FileExporter } from "./exporters/file.ts";
|
||||||
import { delay, showError } from "./utils.ts";
|
import { delay, showError } from "./utils.ts";
|
||||||
import { GameFetcher } from "./GameFetcher.ts";
|
import { GameFetcher } from "./GameFetcher.ts";
|
||||||
import { DEFAULT_ENV, Env } from "./env.ts";
|
import { DEFAULT_ENV, Env } from "./env.ts";
|
||||||
|
import { SplashcatExporter } from "./exporters/splashcat.ts";
|
||||||
|
|
||||||
export type Opts = {
|
export type Opts = {
|
||||||
profilePath: string;
|
profilePath: string;
|
||||||
|
|
@ -220,6 +221,29 @@ export class App {
|
||||||
out.push(new FileExporter(state.fileExportPath));
|
out.push(new FileExporter(state.fileExportPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (exporters.includes("splashcat")) {
|
||||||
|
if (!state.splashcatApiKey) {
|
||||||
|
const key = (await this.env.prompts.prompt(
|
||||||
|
"Splashcat API key is not set. Please enter below.",
|
||||||
|
)).trim();
|
||||||
|
if (!key) {
|
||||||
|
this.env.logger.error("API key is required.");
|
||||||
|
Deno.exit(1);
|
||||||
|
}
|
||||||
|
await this.profile.writeState({
|
||||||
|
...state,
|
||||||
|
splashcatApiKey: key,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
out.push(
|
||||||
|
new SplashcatExporter({
|
||||||
|
splashcatApiKey: this.profile.state.splashcatApiKey!,
|
||||||
|
uploadMode: this.opts.monitor ? "Monitoring" : "Manual",
|
||||||
|
env: this.env,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
exporterProgress(title: string) {
|
exporterProgress(title: string) {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ export type State = {
|
||||||
statInkApiKey?: string;
|
statInkApiKey?: string;
|
||||||
fileExportPath: string;
|
fileExportPath: string;
|
||||||
monitorInterval: number;
|
monitorInterval: number;
|
||||||
|
splashcatApiKey?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DEFAULT_STATE: State = {
|
export const DEFAULT_STATE: State = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue