mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 12:55:16 -07:00
feat(launcher): add --version / -v flag to print app version
- Exits early with `SubMiner <version>` output, no app binary required - Maps `-v` at root level without conflicting with `stats cleanup -v` - Adds `version: boolean` to `Args` type and default args - Documents flag in docs-site and adds changelog fragment
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import path from 'node:path';
|
||||
import packageJson from '../package.json';
|
||||
import {
|
||||
loadLauncherJellyfinConfig,
|
||||
loadLauncherMpvConfig,
|
||||
@@ -20,6 +21,11 @@ import { runJellyfinCommand } from './commands/jellyfin-command.js';
|
||||
import { runPlaybackCommand } from './commands/playback-command.js';
|
||||
import { runUpdateCommand } from './commands/update-command.js';
|
||||
|
||||
const APP_VERSION =
|
||||
typeof packageJson.version === 'string' && packageJson.version.trim()
|
||||
? packageJson.version
|
||||
: 'unknown';
|
||||
|
||||
function createCommandContext(
|
||||
args: ReturnType<typeof parseArgs>,
|
||||
scriptPath: string,
|
||||
@@ -56,6 +62,12 @@ async function main(): Promise<void> {
|
||||
const launcherConfig = loadLauncherYoutubeSubgenConfig();
|
||||
const launcherMpvConfig = loadLauncherMpvConfig();
|
||||
const args = parseArgs(process.argv.slice(2), scriptName, launcherConfig, launcherMpvConfig);
|
||||
|
||||
if (args.version) {
|
||||
console.log(`SubMiner ${APP_VERSION}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const pluginRuntimeConfig = readPluginRuntimeConfig(args.logLevel);
|
||||
const appPath = findAppBinary(scriptPath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user