refactor: trim internal helper exports

This commit is contained in:
Peter Steinberger
2026-05-02 07:18:57 +01:00
parent 5e35112d21
commit 5acfc89175
7 changed files with 13 additions and 46 deletions

View File

@@ -20,7 +20,7 @@ export function readFlagValue(args, name) {
return undefined;
}
export function consumeStringFlag(argv, index, flag, currentValue) {
function consumeStringFlag(argv, index, flag, currentValue) {
if (argv[index] !== flag) {
return null;
}
@@ -30,18 +30,7 @@ export function consumeStringFlag(argv, index, flag, currentValue) {
};
}
export function consumeStringListFlag(argv, index, flag) {
if (argv[index] !== flag) {
return null;
}
const value = argv[index + 1];
return {
nextIndex: index + 1,
value: typeof value === "string" && value.length > 0 ? value : null,
};
}
export function consumeIntFlag(argv, index, flag, currentValue, options = {}) {
function consumeIntFlag(argv, index, flag, currentValue, options = {}) {
if (argv[index] !== flag) {
return null;
}
@@ -53,7 +42,7 @@ export function consumeIntFlag(argv, index, flag, currentValue, options = {}) {
};
}
export function consumeFloatFlag(argv, index, flag, currentValue, options = {}) {
function consumeFloatFlag(argv, index, flag, currentValue, options = {}) {
if (argv[index] !== flag) {
return null;
}
@@ -84,25 +73,6 @@ export function stringFlag(flag, key) {
};
}
export function stringListFlag(flag, key) {
return {
consume(argv, index) {
const option = consumeStringListFlag(argv, index, flag);
if (!option) {
return null;
}
return {
nextIndex: option.nextIndex,
apply(target) {
if (option.value) {
target[key].push(option.value);
}
},
};
},
};
}
function createAssignedValueFlag(consumeOption) {
return {
consume(argv, index, args) {