Skip to content

Implement exec subcommand #5

@mikkeldamsgaard

Description

@mikkeldamsgaard

Summary

Implement the exec subcommand for running arbitrary commands with structured logging.

Requirements

  • Execute command via execve (no shell) using -- separator
  • Capture stdout/stderr and print with timestamps
  • Optional JSON log output via --json
  • Forward the child process exit code
  • Support --workdir for setting the working directory of the child process
  • Intended for use with custom images, add a section to usage.md about how to build an image with this as base with a set of commands that can be executed this way, it could be openssl to seed the container with a private key.
  • Add an additional docker file and image that builds jq and yq into the image. Call it initium-jyq. Update release.yml

Acceptance Criteria

  • internal/cmd/exec.go with full implementation
  • internal/cmd/exec_test.go with tests for: success, failure exit codes, -- parsing, stdout/stderr capture, JSON logging
  • Registered in cmd/initium/main.go
  • docs/usage.md updated with exec section
  • CHANGELOG.md updated
  • All tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions