Closed killertofus closed 2 months ago
--version
, similar to --help,
is part of NW.js/Chromium, which is interpreted before any application code is loaded and executed, as well as any Chromium-relevant code itself. There is no way for application logic to work around that because it's interpreted right at the beginning when launching NW.js/Chromium.
Something could be added to print the version when using the -- --version
arguments (two leading dashes)
diff --git a/src/app/nwjs/argv.js b/src/app/nwjs/argv.js
index 13b37f29..b49fda75 100644
--- a/src/app/nwjs/argv.js
+++ b/src/app/nwjs/argv.js
@@ -1,5 +1,5 @@
import minimist from "minimist";
-import { argv as appArgv, filteredArgv, manifest, dataPath } from "nwjs/App";
+import { default as App, argv as appArgv, filteredArgv, manifest, dataPath } from "nwjs/App";
import Parameter from "utils/parameters/Parameter";
import ParameterCustom from "utils/parameters/ParameterCustom";
import { dirname } from "path";
@@ -147,3 +147,8 @@ export function parseCommand( command ) {
export const argv = minimist( appArgv, minimistOptions );
+
+if ( /(^|\s)--version(\s|$)/.test( argv[ "_" ] || "" ) ) {
+ process.stdout.write( `${manifest[ "name" ]} ${manifest[ "version" ] }\n` );
+ App.quit();
+}
but I don't think this is very useful, because it launches the entire application, just in order to read the version string from the manifest JSON.
Checklist
Description
when you type
streamlink-twitch-gui --version
it showsnwjs 120.0.6099.129
streamlink-twitch-gui -v
or something like that should show2.5.2
or2.5.2 nwjs 120.0.6099.129