Skip to content

Commit

Permalink
Improve help text and add usage exampes
Browse files Browse the repository at this point in the history
Fixes #85
  • Loading branch information
qasimwarraich authored and cloudlena committed Feb 10, 2024
1 parent 997ac17 commit 7d827b3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
7 changes: 4 additions & 3 deletions internal/livelint/check_can_access_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ func (n *Livelint) canPortForward(pod apiv1.Pod, port int32, checkFunc func(uint
}
}()

// wait for port forwarding to be ready
// for range readyChan {
// }
for range readyChan {
//for golangci-lint
fmt.Println("")
}

n.ui.StartSpinner()

Expand Down
29 changes: 23 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"log"
"os"

"github.com/bespinian/livelint/internal/app"

Check failure on line 8 in main.go

View workflow job for this annotation

GitHub Actions / Verify

could not import github.com/bespinian/livelint/internal/app (-: # github.com/bespinian/livelint/internal/app
Expand All @@ -20,9 +21,11 @@ func main() {

Commands: []*cli.Command{
{
Name: "check",
Aliases: []string{"c"},
Usage: "checks a Kubernetes deployment for issues",
Name: "check",
Aliases: []string{"c"},
Usage: "livelint check/c [--namespace/-n <namespace>] <deployment name>",
UsageText: "livelint check my-deployment\nlivelint check --namespace default my-deployment",
Description: "Checks a Kubernetes deployment for issues",

Flags: []cli.Flag{
&cli.StringFlag{
Expand All @@ -42,10 +45,11 @@ func main() {
Action: func(c *cli.Context) error {
bubbletea := livelint.NewBubbleTeaInterface(tea.NewProgram(livelint.InitialModel()))

Check failure on line 46 in main.go

View workflow job for this annotation

GitHub Actions / Verify

undefined: livelint.NewBubbleTeaInterface (typecheck)
namespace := c.String("namespace")
args := c.Args().First()
fmt.Println(args)
app, err := app.New(namespace, c.Args().First(), bubbletea)
if err != nil {
if err := cli.ShowSubcommandHelp(c) != nil; err {
log.Println(err)
}
exitWithErr(err)
}

Expand All @@ -64,6 +68,19 @@ func main() {

return nil
},

OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
if isSubcommand {
if err := cli.ShowSubcommandHelp(c) != nil; err {
log.Println(err)
}
} else {
if err := cli.ShowAppHelp(c) != nil; err {
log.Println(err)
}
}
return err
},
},
},

Expand All @@ -80,6 +97,6 @@ func main() {
}

func exitWithErr(err error) {
_, _ = fmt.Fprintf(os.Stderr, "failed to start livelint: %s\n", err)
_, _ = fmt.Fprintf(os.Stderr, "\nfailed to start livelint: %s\n", err)
os.Exit(1)
}

0 comments on commit 7d827b3

Please sign in to comment.