mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-01 18:22:41 -08:00
fix(logging): apply cli log level on second-instance commands
This commit is contained in:
@@ -220,6 +220,18 @@ test('handleCliCommand processes --start for second-instance when overlay runtim
|
||||
);
|
||||
});
|
||||
|
||||
test('handleCliCommand applies cli log level for second-instance commands', () => {
|
||||
const { deps, calls } = createDeps({
|
||||
setLogLevel: (level) => {
|
||||
calls.push(`setLogLevel:${level}`);
|
||||
},
|
||||
});
|
||||
|
||||
handleCliCommand(makeArgs({ start: true, logLevel: 'debug' }), 'second-instance', deps);
|
||||
|
||||
assert.ok(calls.includes('setLogLevel:debug'));
|
||||
});
|
||||
|
||||
test('handleCliCommand runs texthooker flow with browser open', () => {
|
||||
const { deps, calls } = createDeps();
|
||||
const args = makeArgs({ texthooker: true });
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CliArgs, CliCommandSource, commandNeedsOverlayRuntime } from '../../cli/args';
|
||||
|
||||
export interface CliCommandServiceDeps {
|
||||
setLogLevel?: (level: NonNullable<CliArgs['logLevel']>) => void;
|
||||
getMpvSocketPath: () => string;
|
||||
setMpvSocketPath: (socketPath: string) => void;
|
||||
setMpvClientSocketPath: (socketPath: string) => void;
|
||||
@@ -127,6 +128,7 @@ interface AppCliRuntime {
|
||||
}
|
||||
|
||||
export interface CliCommandDepsRuntimeOptions {
|
||||
setLogLevel?: (level: NonNullable<CliArgs['logLevel']>) => void;
|
||||
mpv: MpvCliRuntime;
|
||||
texthooker: TexthookerCliRuntime;
|
||||
overlay: OverlayCliRuntime;
|
||||
@@ -149,6 +151,7 @@ export function createCliCommandDepsRuntime(
|
||||
options: CliCommandDepsRuntimeOptions,
|
||||
): CliCommandServiceDeps {
|
||||
return {
|
||||
setLogLevel: options.setLogLevel,
|
||||
getMpvSocketPath: options.mpv.getSocketPath,
|
||||
setMpvSocketPath: options.mpv.setSocketPath,
|
||||
setMpvClientSocketPath: (socketPath) => {
|
||||
@@ -232,6 +235,10 @@ export function handleCliCommand(
|
||||
source: CliCommandSource = 'initial',
|
||||
deps: CliCommandServiceDeps,
|
||||
): void {
|
||||
if (args.logLevel) {
|
||||
deps.setLogLevel?.(args.logLevel);
|
||||
}
|
||||
|
||||
const hasNonStartAction =
|
||||
args.stop ||
|
||||
args.toggle ||
|
||||
|
||||
Reference in New Issue
Block a user