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

Support -9e as an argument for xz compression #101

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/pi-gen-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,17 @@ export async function validateConfig(config: PiGenConfig): Promise<void> {
)
}

if (
!['none', 'zip', 'gz', 'xz'].includes(
config.deployCompression?.toLowerCase()
)
) {
const deployCompression = config.deployCompression?.toLowerCase()
if (!['none', 'zip', 'gz', 'xz'].includes(deployCompression)) {
throw new Error('compression must be one of ["none", "zip", "gz", "xz"]')
}

if (!/^[0-9]$/.test(config.compressionLevel)) {
throw new Error('compression-level must be between 0 and 9')
if (
!/^[0-9]$/.test(config.compressionLevel) &&
dtcooper marked this conversation as resolved.
Show resolved Hide resolved
deployCompression === 'xz' &&
config.compressionLevel !== '9e'
) {
throw new Error('compression-level must be between 0 and 9 (or 9e for xz)')
}

const cutCmd = await io.which('cut', true)
Expand Down
Loading