This is an automated email from the ASF dual-hosted git repository. andk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
commit f7a54c8b8ce7ada5cc7069b72ac013ebca34f5f9 Author: Andrzej Kaczmarek <[email protected]> AuthorDate: Fri Oct 25 08:13:42 2024 +0200 Make newt upgrade more verbose This improves newt upgrade output to include message when it's fetching updates to each repository and also skips "trying to make changes..." message if there's no prompt requested. --- newt/install/install.go | 17 +++++++---------- newt/repo/repo.go | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/newt/install/install.go b/newt/install/install.go index bad51cae..36faf4fd 100644 --- a/newt/install/install.go +++ b/newt/install/install.go @@ -289,8 +289,7 @@ func (inst *Installer) filterUpgradeList( } curVer.Commit = ver.Commit util.StatusMessage(util.VERBOSITY_DEFAULT, - "Skipping \"%s\": already upgraded (%s)\n", - name, curVer.String()) + "Skipping %s, already upgraded to version %s\n", name, curVer.String()) } } @@ -348,6 +347,9 @@ func (inst *Installer) installPrompt(vm deprepo.VersionMap, op installOp, return true, nil } + if !ask { + return true, nil + } util.StatusMessage(util.VERBOSITY_DEFAULT, "Trying to make the following changes to the project:\n") @@ -374,10 +376,6 @@ func (inst *Installer) installPrompt(vm deprepo.VersionMap, op installOp, } } - if !ask { - return true, nil - } - for { fmt.Printf("Proceed? [Y/n] ") line, more, err := bufio.NewReader(os.Stdin).ReadLine() @@ -570,13 +568,12 @@ func (inst *Installer) Upgrade(candidates []*repo.Repo, force bool, } } + util.StatusMessage(util.VERBOSITY_DEFAULT, + "Upgrading %s to version %s\n", r.Name(), destVer.String()) + if err := r.Upgrade(destVer); err != nil { return err } - - util.StatusMessage(util.VERBOSITY_DEFAULT, - "%s successfully upgraded to version %s\n", - r.Name(), destVer.String()) } for _, r := range candidates { diff --git a/newt/repo/repo.go b/newt/repo/repo.go index 5c2419c1..8193e0ba 100644 --- a/newt/repo/repo.go +++ b/newt/repo/repo.go @@ -382,7 +382,7 @@ func (r *Repo) UpdateDesc() (bool, error) { return false, nil } - util.StatusMessage(util.VERBOSITY_VERBOSE, "[%s]:\n", r.Name()) + util.StatusMessage(util.VERBOSITY_DEFAULT, "Fetching %s\n", r.Name()) // Make sure the repo's "origin" remote points to the correct URL. This is // necessary in case the user changed his `project.yml` file to point to a
