Skip to content

Commit

Permalink
Adding ability to import and install archives via cmdline
Browse files Browse the repository at this point in the history
closes #16896
  • Loading branch information
IDCs committed Jan 14, 2025
1 parent 2b8e5e6 commit 16320b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/extensions/download_management/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,18 @@ function processCommandline(api: IExtensionApi) {
const { commandLine } = state.session.base;

const cliUrl = commandLine.download ?? commandLine.install;

if (cliUrl) {
api.events.emit('start-download-url', cliUrl, undefined, commandLine.install !== undefined);
}

const arcPath = commandLine.installArchive;
if (typeof arcPath === 'string' && path.isAbsolute(arcPath)) {
api.events.emit('import-downloads', [arcPath], (dlIds: string[]) => {
dlIds.forEach(dlId => {
api.events.emit('start-install-download', dlId);
});
});
}
}

function init(context: IExtensionContextExt): boolean {
Expand Down
4 changes: 4 additions & 0 deletions src/util/commandLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import startupSettings from './startupSettings';
export interface IParameters {
download?: string;
install?: string;
installArchive?: string;
installExtension?: string;
report?: string;
restore?: string;
Expand Down Expand Up @@ -50,6 +51,7 @@ const ARG_COUNTS = {
'-s': 1,
'--download': 1,
'--install': 1,
'--install-archive': 1,
'--install-extension': 1,
'--start-minimized': 1,
'--game': 1,
Expand Down Expand Up @@ -168,6 +170,7 @@ function parseCommandline(argv: string[], electronIsShitHack: boolean): IParamet
+ '(any supported protocol like nxm:, https:, ...).')
.option('-i, --install <url>', 'Start downloadling & installing the specified url '
+ '(any supported protocol like nxm:, https:, ...).')
.option('--install-archive <path>', 'Start installing the specified archive. Use absolute path.')
.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. '
Expand Down Expand Up @@ -222,6 +225,7 @@ const SKIP_ARGS = {
'--game': 1,
'--profile': 1,
'--install': 1,
'--install-archive': 1,
'--install-extension': 1,
'--restore': 1,
'--merge': 1,
Expand Down

0 comments on commit 16320b9

Please sign in to comment.