@Command(name="run",description="Start a new job")publicclassRunCommandextendsBaseCommand{@Option(names={"--tag","-t"},description="Tag for filtering")privateStringtag;@Option(names={"--max-retries"},description="Override max retries")privateIntegermaxRetries;@Option(names={"--retry-delay"},description="Override retry delay (seconds)")privateIntegerretryDelay;@Option(names={"--timeout"},description="Job timeout (seconds)")privateIntegertimeout;@Parameters(description="Command to run",arity="1..*")privateList<String>command;@OverridepublicIntegercall(){// 1. Validate command// 2. Create job via IPC (or directly if --offline)// 3. Output job info// 4. Return 0 on success, non-zero on error}}
2. Usage Examples
# Basic usage
barn run echo hello
# With tag
barn run --tag=download curl -o file.mp4 https://example.com/video.mp4
# With retry settings
barn run --max-retries=5 --retry-delay=60 ffmpeg -i input.mp4 output.mp4
# JSON output
barn run --output=json echo hello
# Offline mode (no service needed)
barn run --offline echo hello
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Imported from GitHub samson-media/barn#9 — opened by @daniel-samson on 2026-01-21 12:38:07 UTC
Overview
Implement the
barn runcommand that starts a new job.Context
README.md(barn run examples)Requirements
1. Run Command
com.samsonmedia.barn.cli.RunCommand.java:2. Usage Examples
3. Offline Mode
When
--offlineis set:4. Output
On success, output the created job info:
Human format:
JSON format:
5. Error Handling
6. Tests Required
RunCommandTest.java: Test command parsing, validationRunCommandOfflineTest.java: Test offline executionAcceptance Criteria
barn run <cmd>creates a job--tagoption sets job tag--max-retriesoverrides config--offlinemode works without servicemvn verifypassesImplementation Notes
For offline mode, directly use JobRepository and JobRunner:
For service mode, send IPC message:
Definition of Done
@daniel-samson commented on 2026-01-21 13:36:30 UTC:
✅ Ticket #9 completed: Implemented 'barn run' command.
RunCommand (src/main/java/com/samsonmedia/barn/cli/RunCommand.java):
Features:
Tests (RunCommandTest.java):
All 484 tests passing. mvn verify successful.