Archived
feat(cli): set up project structure and main entry point (#1)
- Create Main.java with picocli integration and testable run() method - Create BarnCommand as root command with all subcommands registered - Add placeholder subcommands: run, status, describe, kill, clean, service, config - Update package structure from org.media.samson to com.samsonmedia.barn - Configure checkstyle to allow underscores in test method names - Add comprehensive tests for all CLI commands (26 tests, 80%+ coverage) Closes #1 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e861e12058
commit
05937b1f7e
14 files changed
+609
-28
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package com.samsonmedia.barn;
|
||||
|
||||
import com.samsonmedia.barn.cli.BarnCommand;
|
||||
|
||||
import picocli.CommandLine;
|
||||
|
||||
/**
|
||||
* Main entry point for the Barn application.
|
||||
*
|
||||
* <p>This class initializes the picocli command line parser and delegates
|
||||
* command execution to the appropriate subcommand handlers.
|
||||
*/
|
||||
public final class Main {
|
||||
|
||||
private Main() {
|
||||
// Utility class - prevent instantiation
|
||||
}
|
||||
|
||||
/**
|
||||
* Main entry point.
|
||||
*
|
||||
* @param args command line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
int exitCode = run(args);
|
||||
System.exit(exitCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the command line and returns the exit code.
|
||||
*
|
||||
* <p>This method is separated from {@link #main(String[])} to enable testing
|
||||
* without calling {@link System#exit(int)}.
|
||||
*
|
||||
* @param args command line arguments
|
||||
* @return the exit code (0 for success, non-zero for failure)
|
||||
*/
|
||||
public static int run(String[] args) {
|
||||
return new CommandLine(new BarnCommand()).execute(args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.samsonmedia.barn.cli;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Root command for the Barn CLI.
|
||||
*
|
||||
* <p>This command serves as the entry point for all barn operations.
|
||||
* When invoked without a subcommand, it displays usage information.
|
||||
*/
|
||||
@Command(
|
||||
name = "barn",
|
||||
mixinStandardHelpOptions = true,
|
||||
version = "barn 0.1.0-SNAPSHOT",
|
||||
description = "Cross-platform job daemon for media processing",
|
||||
subcommands = {
|
||||
RunCommand.class,
|
||||
StatusCommand.class,
|
||||
DescribeCommand.class,
|
||||
KillCommand.class,
|
||||
CleanCommand.class,
|
||||
ServiceCommand.class,
|
||||
ConfigCommand.class
|
||||
}
|
||||
)
|
||||
public class BarnCommand implements Runnable {
|
||||
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// When no subcommand is specified, show usage
|
||||
spec.commandLine().usage(spec.commandLine().getOut());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.samsonmedia.barn.cli;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Command to remove completed jobs.
|
||||
*
|
||||
* <p>Placeholder implementation - full implementation in ticket #13.
|
||||
*/
|
||||
@Command(
|
||||
name = "clean",
|
||||
mixinStandardHelpOptions = true,
|
||||
description = "Remove completed jobs"
|
||||
)
|
||||
public class CleanCommand implements Runnable {
|
||||
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
spec.commandLine().getOut().println("Clean command not yet implemented");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.samsonmedia.barn.cli;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Command for configuration management.
|
||||
*
|
||||
* <p>Placeholder implementation - full implementation in ticket #21.
|
||||
*/
|
||||
@Command(
|
||||
name = "config",
|
||||
mixinStandardHelpOptions = true,
|
||||
description = "Configuration management"
|
||||
)
|
||||
public class ConfigCommand implements Runnable {
|
||||
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
spec.commandLine().usage(spec.commandLine().getOut());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.samsonmedia.barn.cli;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Command to show detailed information about a specific job.
|
||||
*
|
||||
* <p>Placeholder implementation - full implementation in ticket #11.
|
||||
*/
|
||||
@Command(
|
||||
name = "describe",
|
||||
mixinStandardHelpOptions = true,
|
||||
description = "Show detailed job information"
|
||||
)
|
||||
public class DescribeCommand implements Runnable {
|
||||
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
spec.commandLine().getOut().println("Describe command not yet implemented");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.samsonmedia.barn.cli;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Command to stop a running job.
|
||||
*
|
||||
* <p>Placeholder implementation - full implementation in ticket #12.
|
||||
*/
|
||||
@Command(
|
||||
name = "kill",
|
||||
mixinStandardHelpOptions = true,
|
||||
description = "Stop a running job"
|
||||
)
|
||||
public class KillCommand implements Runnable {
|
||||
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
spec.commandLine().getOut().println("Kill command not yet implemented");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.samsonmedia.barn.cli;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Command to start a new job.
|
||||
*
|
||||
* <p>Placeholder implementation - full implementation in ticket #9.
|
||||
*/
|
||||
@Command(
|
||||
name = "run",
|
||||
mixinStandardHelpOptions = true,
|
||||
description = "Start a new job"
|
||||
)
|
||||
public class RunCommand implements Runnable {
|
||||
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
spec.commandLine().getOut().println("Run command not yet implemented");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.samsonmedia.barn.cli;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Command to manage the Barn service.
|
||||
*
|
||||
* <p>Placeholder implementation - full implementation in ticket #16.
|
||||
*/
|
||||
@Command(
|
||||
name = "service",
|
||||
mixinStandardHelpOptions = true,
|
||||
description = "Manage the Barn service"
|
||||
)
|
||||
public class ServiceCommand implements Runnable {
|
||||
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
spec.commandLine().usage(spec.commandLine().getOut());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.samsonmedia.barn.cli;
|
||||
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Command to show status of all jobs.
|
||||
*
|
||||
* <p>Placeholder implementation - full implementation in ticket #10.
|
||||
*/
|
||||
@Command(
|
||||
name = "status",
|
||||
mixinStandardHelpOptions = true,
|
||||
description = "Show status of all jobs"
|
||||
)
|
||||
public class StatusCommand implements Runnable {
|
||||
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
spec.commandLine().getOut().println("Status command not yet implemented");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user