Skip to content

Use FilePath for CLI image/container path-arg parsing#24

Open
chrisgeo wants to merge 1 commit into
mainfrom
feat/chaos-1457-cli-image-filepath
Open

Use FilePath for CLI image/container path-arg parsing#24
chrisgeo wants to merge 1 commit into
mainfrom
feat/chaos-1457-cli-image-filepath

Conversation

@chrisgeo

@chrisgeo chrisgeo commented May 9, 2026

Copy link
Copy Markdown

Summary

  • Adds FilePath.absolute(_:relativeTo:) helper in Sources/ContainerCommands/FilePath+Absolute.swift for resolving CLI path arguments against the current working directory and lexically normalizing the result.
  • Replaces the URL(fileURLWithPath:relativeTo:.currentDirectory()).absoluteURL.path(percentEncoded:) boilerplate at three CLI commands: ImageLoad, ImageSave, ContainerExport.
  • Switches FileManager.moveItem(at:to:) to moveItem(atPath:toPath:) in ContainerExport so both arguments come from FilePath.string.

Closes CHAOS-1457. Sibling of apple#1480 (HostDNSResolver) and apple#1518 (PacketFilter), same migration pattern.

Test plan

  • swift build succeeds.
  • swift test --filter FilePathAbsoluteTests — 9/9 tests pass (absolute / relative / .. / ..-past-cwd-root / empty string / root / / trailing slash / single filename).
  • Manual: container image load --input ./archive.tar resolves to absolute path.
  • Manual: container image save --output /tmp/foo.tar <id> preserves absolute path.
  • Manual: container container export --output /tmp/x.tar <id> writes to expected location.

@linear

linear Bot commented May 9, 2026

Copy link
Copy Markdown

CHAOS-1457

@github-actions github-actions Bot added the cli label May 9, 2026
- Closes CHAOS-1457.
- Adds shared FilePath.absolute(_:relativeTo:) helper.
- Sibling of apple#1480 (HostDNSResolver) and apple#1518 (PacketFilter), same pattern.
@chrisgeo chrisgeo force-pushed the feat/chaos-1457-cli-image-filepath branch from b0712f4 to fe910bb Compare May 24, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant