Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion console/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (r *Application) Run(args []string, exitIfArtisan bool) error {
if artisanIndex != -1 {
command := r.command()
if artisanIndex+1 == len(args) {
args = append(args, "help")
args = append(args, "list")
}

cliArgs := append([]string{args[0]}, args[artisanIndex+1:]...)
Expand Down
8 changes: 4 additions & 4 deletions console/cli_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestShowCommandHelp_HelpPrinterCustom(t *testing.T) {
cliApp.Register([]contractsconsole.Command{
&TestFooCommand{},
&TestBarCommand{},
console.NewHelpCommand(),
console.NewListCommand(),
})

tests := []struct {
Expand All @@ -35,8 +35,8 @@ func TestShowCommandHelp_HelpPrinterCustom(t *testing.T) {
containsOutput []string
}{
{
name: "print app help",
call: "help",
name: "print commands list",
call: "list",
containsOutput: []string{
color.Yellow().Sprint("Usage:"),
color.Yellow().Sprint("Global options:"),
Expand Down Expand Up @@ -144,7 +144,7 @@ Global options:
-v, --version Print the version

Available commands:
help Shows a list of commands
list List commands
test:
test:bar Test command
test:foo Test command`,
Expand Down
35 changes: 0 additions & 35 deletions console/console/help_command.go

This file was deleted.

14 changes: 6 additions & 8 deletions console/console/list_command.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package console

import (
"github.com/urfave/cli/v3"

"github.com/goravel/framework/contracts/console"
"github.com/goravel/framework/contracts/console/command"
)

type ListCommand struct {
artisan console.Artisan
}
type ListCommand struct{}

func NewListCommand(artisan console.Artisan) *ListCommand {
return &ListCommand{
artisan: artisan,
}
func NewListCommand() *ListCommand {
return &ListCommand{}
}

// Signature The name and signature of the console command.
Expand All @@ -32,5 +30,5 @@ func (r *ListCommand) Extend() command.Extend {

// Handle Execute the console command.
func (r *ListCommand) Handle(ctx console.Context) error {
return r.artisan.Call("--help")
return cli.ShowAppHelp(ctx.Instance())
}
3 changes: 1 addition & 2 deletions console/service_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ func (r *ServiceProvider) registerCommands(app foundation.Application) {
}

artisanFacade.Register([]consolecontract.Command{
console.NewListCommand(artisanFacade),
console.NewListCommand(),
console.NewKeyGenerateCommand(configFacade),
console.NewMakeCommand(),
console.NewBuildCommand(configFacade),
console.NewHelpCommand(),
})
}