Skip to content

Commit

Permalink
feat: cardinal pretty logging, improve goroutine reliability, kill --…
Browse files Browse the repository at this point in the history
…watch (#64)

### TL;DR

### What changed?

- `world cardinal dev` now use pretty logging on latest Cardinal
version. This is done by setting `CARDINAL_PRETTY_LOG` to true.
- Refactors to goroutine management in `world cardinal start` and `world
cardinal dev` to make it more reliable using error group.
- Disable printing the usage guide when a command returns an error.
- Various string reformatting using lipgloss to make things look pretty.
- Prevent exit code 130, 137, 143 from being treated as an error since
it's an expected exit code from Docker when it receives termination
signal (i.e. Ctrl + C, SIGKILL, SIGTERM, etc)
- Kill `world cardinal dev --watch` flag because runner is ugly and
buggy af

### How to test?

1. Run `world cardinal dev` and `world cardinal start` and try to break
it. This includes running it against various edge cases (i.e. Redis
already running, kill redis when cardinal is running, etc)
  • Loading branch information
smsunarto authored May 20, 2024
1 parent 03aa9eb commit ef82596
Show file tree
Hide file tree
Showing 13 changed files with 421 additions and 366 deletions.
2 changes: 1 addition & 1 deletion cmd/world/cardinal/cardinal.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ var BaseCmd = &cobra.Command{
func init() {
// Register subcommands - `world cardinal [subcommand]`
BaseCmd.AddCommand(startCmd, devCmd, restartCmd, purgeCmd, stopCmd)
// Add --debug flag
// Add --log-debug flag
logger.AddLogFlag(startCmd, devCmd, restartCmd, purgeCmd, stopCmd)
}
7 changes: 7 additions & 0 deletions cmd/world/cardinal/common_flag.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package cardinal

import "github.com/spf13/cobra"

func registerEditorFlag(cmd *cobra.Command, defaultEnable bool) {
cmd.Flags().Bool("editor", defaultEnable, "Run Cardinal Editor, useful for prototyping and debugging")
}
Loading

0 comments on commit ef82596

Please sign in to comment.