change signature of interfaces to fit Interface interface
This commit is contained in:
@@ -11,8 +11,14 @@ import (
|
||||
// CLIConfig is an alias for service.Config, used to configure the CLI.
|
||||
type CLIConfig = service.Config
|
||||
|
||||
type CLI struct{}
|
||||
|
||||
func NewCli() *CLI {
|
||||
return &CLI{}
|
||||
}
|
||||
|
||||
// Run initializes the services and executes the CLI commands.
|
||||
func Run(ctx context.Context, config CLIConfig) error {
|
||||
func (c *CLI) Run(ctx context.Context, config CLIConfig) error {
|
||||
svc, cleanup, err := service.NewServices(ctx, config)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -30,7 +36,7 @@ func Run(ctx context.Context, config CLIConfig) error {
|
||||
}
|
||||
|
||||
// RunWithArgs initializes the services and executes the CLI commands with the provided arguments.
|
||||
func RunWithArgs(ctx context.Context, config CLIConfig, args []string) error {
|
||||
func (c *CLI) RunWithArgs(ctx context.Context, config CLIConfig, args []string) error {
|
||||
svc, cleanup, err := service.NewServices(ctx, config)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -22,8 +22,14 @@ You can also run shell commands directly. Type 'exit' or 'quit' to leave.`
|
||||
ReplTitle = "Welcome to Project Management CLI! " + ReplHelp
|
||||
)
|
||||
|
||||
type REPL struct{}
|
||||
|
||||
func NewRepl() *REPL {
|
||||
return &REPL{}
|
||||
}
|
||||
|
||||
// RunREPL starts the interactive Read-Eval-Print Loop for the PM CLI.
|
||||
func RunREPL(ctx context.Context, config cli.CLIConfig) error {
|
||||
func (r *REPL) Run(ctx context.Context, config cli.CLIConfig) error {
|
||||
// Set terminal to raw mode to capture input properly in the REPL.
|
||||
// This allows us to handle input character by character and provide a better user experience.
|
||||
// We also ensure that the terminal state is restored when the REPL exits, even if an error occurs.
|
||||
|
||||
Reference in New Issue
Block a user