mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-13 08:15:14 +02:00
refactor: share managed runtime install policy parsing
This commit is contained in:
parent
f9806e69c7
commit
f30f4d688d
3 changed files with 31 additions and 12 deletions
|
|
@ -15,6 +15,19 @@ import {
|
|||
|
||||
export type KtxManagedPythonInstallPolicy = 'prompt' | 'auto' | 'never';
|
||||
|
||||
export function runtimeInstallPolicyFromFlags(options: {
|
||||
yes?: boolean;
|
||||
input?: boolean;
|
||||
}): KtxManagedPythonInstallPolicy {
|
||||
if (options.yes === true && options.input === false) {
|
||||
throw new Error('Choose only one runtime install mode: --yes or --no-input');
|
||||
}
|
||||
if (options.yes === true) {
|
||||
return 'auto';
|
||||
}
|
||||
return options.input === false ? 'never' : 'prompt';
|
||||
}
|
||||
|
||||
export interface ManagedPythonCommandRuntime {
|
||||
layout: ManagedPythonRuntimeLayout;
|
||||
manifest: InstalledKtxRuntimeManifest;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue