Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Line Option For Installing From Archive #16896

Open
EldritchCarMaker opened this issue Dec 24, 2024 · 1 comment · May be fixed by #17002
Open

Command Line Option For Installing From Archive #16896

EldritchCarMaker opened this issue Dec 24, 2024 · 1 comment · May be fixed by #17002
Labels
improvement 📈 An issue that improves an existing feature

Comments

@EldritchCarMaker
Copy link

Is your feature request related to a problem? Please describe.
There's command line arguments for downloading and installing from a URL, but there's no option for installing from an archive on disk. The --download and --install options both act as downloads.

Describe the solution you'd like
A new argument, likely named something like --install-archive which skips the download aspect of the existing --install option, only emitting the install mod event. Would likely take an absolute file path, optionally a friendly name or destination name if required.

Describe alternatives you've considered
It seemed feasible to create an isolated extension to simply emit the install mod event, but the problem with that is it then requires a unique form of communication with the external app that would otherwise be supplying command line arguments. As best I could tell, the command line options were the easiest form of simple communication with the desktop app (and is also the method that the nexus site itself uses to facilitate downloads) and it seemed infeasible for vortex extensions to "add" new launch argument options, or even listen to them.

Another potential alternative, that may be slightly more expandable in the future but may also be more work intensive, is to allow vortex extensions better access to launch arguments. Including giving them access to an event to be triggered to listen for specific arguments that vortex alone doesn't handle (the app already seemingly allows unknown options, I believe this could be as simple as allowing them to emit events, but it could be far more complicated than that)

Additional context
This feature would be extremely convenient for allowing 3rd party apps to better (and, more importantly, easier) integrate with vortex, by allowing a quick and easy way to direct vortex to install a file. This is already capability vortex has, but it's not accessible through launch arguments, and I don't honestly know why that is. I can only assume it never came up before. I would make a full PR myself, but I don't have experience with electron or even typescript alone, so it's likely easier left to those with more experience in this area.

@EldritchCarMaker
Copy link
Author

For further context, here are the areas I believe would need the change primarily

Command line parsing:

const commandLine = program
.command('Vortex')
.version(version)
.option('-d, --download <url>', 'Start downloadling the specified url '
+ '(any supported protocol like nxm:, https:, ...).')
.option('-i, --install <url>', 'Start downloadling & installing the specified url '
+ '(any supported protocol like nxm:, https:, ...).')
.option('--install-extension <id>', 'Start downloadling & installing the specified '
+ 'vortex extension. id can be "modId:<number>".')
.option('-g, --get <path>', 'Print the state variable at the specified path and quit. '
+ 'This can be used repeatedly to print multiple items',
collect)
.option('-s, --set <path=value>', 'Change a value in the state. Please be very careful '
+ 'with this, incorrect use will break Vortex and you may '
+ 'lose data', assign)
.option('--del <path>', 'Remove a value in state', collect)
.option('--user-data <path>', 'Starts Vortex with a custom directory for the user data. '
+ 'Only use if you know what you\'re doing.')
.option('--start-minimized', 'Starts Vortex in the task bar')
.option('--game <game id>', 'Starts Vortex with a different game enabled')
.option('--run <path>', 'Execute the js program instead of Vortex itself.')
.option('--report <path>', 'Send an error report. For internal use')
.option('--restore <path>', 'Restore a state backup')
.option('--merge <path>', 'Merge a state backup. Unlike restore, the content of the specified '
+ 'state file will be merged into the existing state.')
.option('--shared', 'Used in conjunction with set, get or del, this will access the database'
+ 'in the shared location instead of the per-user one')
.option('--max-memory <size in MB>', 'Maximum amount of memory Vortex may use in MB '
+ '(defaults to 4096)')
.option('--inspector', 'Start Vortex with the chrome inspector opened')
.option('--profile <profile id>', 'Start Vortex with a specific profile active')
.option('--epic-auth-login <login>')
.option('--epic-auth-password <password>')
.option('--epic-auth-type <type>')
.option('--epic-app <app>')
.option('--epic-env <env>')
.option('--epic-portal')
.option('--epic-username <username>')
.option('--epic-userid <userid>')
.option('--epic-locale <locale>')
.option('--epic-sandboxid <sandboxid>')
// allow unknown options since they may be interpreted by electron/node
.allowUnknownOption(true)
.parse(argv || []).opts() as IParameters;

Implementation of install and download arguments:

Vortex/src/app/Application.ts

Lines 1100 to 1110 in ae314a5

private applyArguments(args: IParameters) {
if (args.download || args.install) {
const prom: Promise<void> = (this.mMainWindow === undefined)
// give the main instance a moment to fully start up
? Promise.delay(2000)
: Promise.resolve(undefined);
prom.then(() => {
if (this.mMainWindow !== undefined) {
this.mMainWindow.sendExternalURL(args.download || args.install,
args.install !== undefined);

And potentially the IParameters interface:

export interface IParameters {
download?: string;
install?: string;
installExtension?: string;
report?: string;
restore?: string;
startMinimized?: boolean;
game?: string;
profile?: string;
get?: string[];
set?: ISetItem[];
del?: string[];
merge?: string;
run?: string;
shared?: boolean;
maxMemory?: string;
disableGPU?: boolean;
userData?: string;
inspector?: boolean;
storeVersion?: string;
}

@IDCs IDCs added the improvement 📈 An issue that improves an existing feature label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement 📈 An issue that improves an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants