Update help command

This commit is contained in:
Michał Gdula 2024-05-06 17:28:18 +01:00
parent 66fb03fa0d
commit 2f40cdcd64
2 changed files with 10 additions and 7 deletions

View file

@ -7,7 +7,7 @@ import (
func Parse() { func Parse() {
if len(os.Args) < 2 { if len(os.Args) < 2 {
fmt.Println("Use -h or --help for usage") fmt.Println("Use -h or -help for usage")
os.Exit(1) os.Exit(1)
} }
@ -19,12 +19,15 @@ func Parse() {
case "status": case "status":
status(os.Args[2:]) status(os.Args[2:])
case "-h": case "-h":
case "--help": fallthrough
case "-help":
fmt.Println("Available commands are:") fmt.Println("Available commands are:")
fmt.Println(" run: starts the server") fmt.Println(" run: starts the server")
fmt.Println(" migrate: migrates database")
fmt.Println(" status: checks if there are pending migrations")
fmt.Println("\nTo specific usages, run commandName -h") fmt.Println("\nTo specific usages, run commandName -h")
default: default:
fmt.Println("Use -h or --help for usage") fmt.Println("Use -h or -help for usage")
os.Exit(1) os.Exit(1)
} }
} }

View file

@ -44,12 +44,12 @@ func Status() error {
return err return err
} }
fmt.Println("Migration list:") fmt.Println("Available migrations:")
for _, migration := range applied { for _, migration := range applied {
fmt.Printf("DONE: %s\n", migration.Id) fmt.Printf(" Complete: %s\n", migration.Id)
} }
for _, migration := range planned { for _, migration := range planned {
fmt.Printf("TODO: %s\n", migration.Id) fmt.Printf(" Pending: %s\n", migration.Id)
} }
return nil return nil