Skip to content

Commit

Permalink
Merge pull request #29 from moul/dev/moul/doctor
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed May 28, 2021
2 parents d3c6d4d + 6b4ff0b commit df23b3a
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 93 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,24 @@
```console
foo@bar:~$ repoman -h
USAGE
repoman
repoman <subcommand>

SUBCOMMANDS
info get project info
doctor perform various checks (read-only)
maintenance perform various maintenance tasks (write)
version show version and build info
template-post-clone replace template

FLAGS
-v false verbose mode
```

[embedmd]:# (.tmp/usage-maintenance.txt console)
```console
foo@bar:~$ repoman maintenance -h
USAGE
maintenance
maintenance [opts] <path...>

FLAGS
-bump-deps false bump dependencies
Expand All @@ -53,7 +57,7 @@ FLAGS
```console
foo@bar:~$ repoman template-post-clone -h
USAGE
template-post-clone
template-post-clone [opts] <path...>

FLAGS
-checkout-main-branch true switch to the main branch before applying the changes
Expand Down
56 changes: 34 additions & 22 deletions depaware.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ package main

import (
"context"
"flag"
"fmt"

"github.com/hokaccha/go-prettyjson"
"go.uber.org/multierr"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
"moul.io/u"
)

func doDoctor(ctx context.Context, args []string) error {
if len(args) < 1 {
return flag.ErrHelp
}
paths := u.UniqueStrings(args)
logger.Debug("doDoctor", zap.Any("opts", opts), zap.Strings("project", paths))

Expand All @@ -36,10 +39,8 @@ func doDoctorOnce(_ context.Context, path string) error {
if err != nil {
return fmt.Errorf("invalid project: %w", err)
}
s, err := prettyjson.Marshal(project)
if err != nil {
return fmt.Errorf("json marshal error: %w", err)
}
fmt.Println(string(s))
_ = project
// FIXME: perform more tests
fmt.Println("OK")
return nil
}
14 changes: 9 additions & 5 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit df23b3a

Please sign in to comment.