feat: add list-method opt and its query

dumb-splashcat-thing
spacemeowx2 2023-06-05 23:26:01 +08:00 committed by imspace
parent 0517bda98d
commit 8a96cb321c
4 changed files with 17 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import { flags } from "./deps.ts";
const parseArgs = (args: string[]) => { const parseArgs = (args: string[]) => {
const parsed = flags.parse(args, { const parsed = flags.parse(args, {
string: ["profilePath", "exporter", "skipMode"], string: ["profilePath", "exporter", "skipMode", "listMethod"],
boolean: ["help", "noProgress", "monitor", "withSummary"], boolean: ["help", "noProgress", "monitor", "withSummary"],
alias: { alias: {
"help": "h", "help": "h",
@ -14,6 +14,7 @@ const parseArgs = (args: string[]) => {
"monitor": ["m"], "monitor": ["m"],
"skipMode": ["s", "skip-mode"], "skipMode": ["s", "skip-mode"],
"withSummary": "with-summary", "withSummary": "with-summary",
"listMethod": "list-method",
}, },
}); });
return parsed; return parsed;
@ -29,6 +30,10 @@ Options:
--exporter <exporter>, -e Exporter list to use (default: stat.ink) --exporter <exporter>, -e Exporter list to use (default: stat.ink)
Multiple exporters can be separated by commas Multiple exporters can be separated by commas
(e.g. "stat.ink,file") (e.g. "stat.ink,file")
--list-method When set to "latest", the latest 50 matches will be obtained.
When set to "all", matches of all modes will be obtained with a maximum of 250 matches (5 modes x 50 matches).
When set to "auto", the latest 50 matches will be obtained. If 50 matches have not been uploaded yet, matches will be obtained from the list of all modes.
"auto" is the default setting.
--no-progress, -n Disable progress bar --no-progress, -n Disable progress bar
--monitor, -m Monitor mode --monitor, -m Monitor mode
--skip-mode <mode>, -s Skip mode (default: null) --skip-mode <mode>, -s Skip mode (default: null)

View File

@ -10,6 +10,8 @@ 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";
export type ListMethod = "latest" | "all" | "auto";
export type Opts = { export type Opts = {
profilePath: string; profilePath: string;
exporter: string; exporter: string;
@ -17,6 +19,7 @@ export type Opts = {
monitor: boolean; monitor: boolean;
withSummary: boolean; withSummary: boolean;
skipMode?: string; skipMode?: string;
listMethod: string;
cache?: Cache; cache?: Cache;
stateBackend?: StateBackend; stateBackend?: StateBackend;
env: Env; env: Env;
@ -28,6 +31,7 @@ export const DEFAULT_OPTS: Opts = {
noProgress: false, noProgress: false,
monitor: false, monitor: false,
withSummary: false, withSummary: false,
listMethod: "auto",
env: DEFAULT_ENV, env: DEFAULT_ENV,
}; };

View File

@ -10,6 +10,7 @@ export enum Queries {
RegularBattleHistoriesQuery = "3baef04b095ad8975ea679d722bc17de", RegularBattleHistoriesQuery = "3baef04b095ad8975ea679d722bc17de",
BankaraBattleHistoriesQuery = "0438ea6978ae8bd77c5d1250f4f84803", BankaraBattleHistoriesQuery = "0438ea6978ae8bd77c5d1250f4f84803",
XBattleHistoriesQuery = "6796e3cd5dc3ebd51864dc709d899fc5", XBattleHistoriesQuery = "6796e3cd5dc3ebd51864dc709d899fc5",
EventBattleHistoriesQuery = "9744fcf676441873c7c8a51285b6aa4d",
PrivateBattleHistoriesQuery = "8e5ae78b194264a6c230e262d069bd28", PrivateBattleHistoriesQuery = "8e5ae78b194264a6c230e262d069bd28",
VsHistoryDetailQuery = "9ee0099fbe3d8db2a838a75cf42856dd", VsHistoryDetailQuery = "9ee0099fbe3d8db2a838a75cf42856dd",
CoopHistoryQuery = "91b917becd2fa415890f5b47e15ffb15", CoopHistoryQuery = "91b917becd2fa415890f5b47e15ffb15",

View File

@ -8,6 +8,7 @@ export type VarsMap = {
[Queries.RegularBattleHistoriesQuery]: []; [Queries.RegularBattleHistoriesQuery]: [];
[Queries.BankaraBattleHistoriesQuery]: []; [Queries.BankaraBattleHistoriesQuery]: [];
[Queries.XBattleHistoriesQuery]: []; [Queries.XBattleHistoriesQuery]: [];
[Queries.EventBattleHistoriesQuery]: [];
[Queries.PrivateBattleHistoriesQuery]: []; [Queries.PrivateBattleHistoriesQuery]: [];
[Queries.VsHistoryDetailQuery]: [{ [Queries.VsHistoryDetailQuery]: [{
vsResultId: string; vsResultId: string;
@ -415,6 +416,11 @@ export type RespMap = {
}; };
[Queries.BankaraBattleHistoriesQuery]: BankaraBattleHistories; [Queries.BankaraBattleHistoriesQuery]: BankaraBattleHistories;
[Queries.XBattleHistoriesQuery]: XBattleHistories; [Queries.XBattleHistoriesQuery]: XBattleHistories;
[Queries.EventBattleHistoriesQuery]: {
eventBattleHistories: {
historyGroups: HistoryGroups<BattleListNode>;
};
};
[Queries.PrivateBattleHistoriesQuery]: { [Queries.PrivateBattleHistoriesQuery]: {
privateBattleHistories: { privateBattleHistories: {
historyGroups: HistoryGroups<BattleListNode>; historyGroups: HistoryGroups<BattleListNode>;