export const toCliFlags = (options) => {
    return Object.entries(options)
        .filter(([_, value]) => value !== '' && value !== undefined && value !== null)
        .map(([key, value]) => {
        return flagToString(key, value);
    })
        .join(' ')
        .replace(/\n/g, ' ');
};
const flagToString = (key, value) => {
    const flag = toKebabCase(key);
    if (Array.isArray(value)) {
        return `--${flag} ${value.join(',')}`;
    }
    if (typeof value === 'boolean') {
        if (value) {
            return `--${flag}`;
        }
        return '';
    }
    return `--${flag} ${value.toString().replace('\n', ' ')}`;
};
const toKebabCase = (str) => {
    return str.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`);
};
