mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sterl...@apache.org
Subject [1/2] incubator-mynewt-newt git commit: rename project show to info. cleanup status messages
Date Mon, 14 Mar 2016 19:24:51 GMT
Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/develop f6d5567aa -> bd9b1bcec


rename project show to info.  cleanup status messages


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/a1f800eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/a1f800eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/a1f800eb

Branch: refs/heads/develop
Commit: a1f800eb69b8f35e36cb05e36392c0a0fa6188a8
Parents: d97b151
Author: Sterling Hughes <sterling@apache.org>
Authored: Mon Mar 14 12:24:36 2016 -0700
Committer: Sterling Hughes <sterling@apache.org>
Committed: Mon Mar 14 12:24:36 2016 -0700

----------------------------------------------------------------------
 newt/cli/project_cmds.go      | 41 ++++++++++----------------------------
 newt/downloader/downloader.go |  2 +-
 newt/project/project.go       | 17 ++++++++++------
 newt/repo/repo.go             |  8 +++++---
 4 files changed, 28 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/a1f800eb/newt/cli/project_cmds.go
----------------------------------------------------------------------
diff --git a/newt/cli/project_cmds.go b/newt/cli/project_cmds.go
index 2d7dec3..bf4fa69 100644
--- a/newt/cli/project_cmds.go
+++ b/newt/cli/project_cmds.go
@@ -20,7 +20,6 @@
 package cli
 
 import (
-	"fmt"
 	"os"
 	"sort"
 	"strings"
@@ -64,7 +63,8 @@ func newRunCmd(cmd *cobra.Command, args []string) {
 		NewtUsage(cmd, err)
 	}
 
-	fmt.Printf("Project %s successfully created\n", newDir)
+	util.StatusMessage(util.VERBOSITY_DEFAULT,
+		"Project %s successfully created.\n", newDir)
 }
 
 func installRunCmd(cmd *cobra.Command, args []string) {
@@ -77,8 +77,6 @@ func installRunCmd(cmd *cobra.Command, args []string) {
 	if err := proj.Install(false, projectForce); err != nil {
 		NewtUsage(cmd, err)
 	}
-
-	fmt.Println("Repos successfully installed")
 }
 
 func upgradeRunCmd(cmd *cobra.Command, args []string) {
@@ -91,11 +89,9 @@ func upgradeRunCmd(cmd *cobra.Command, args []string) {
 	if err := proj.Upgrade(projectForce); err != nil {
 		NewtUsage(cmd, err)
 	}
-
-	fmt.Println("Repos successfully upgrade")
 }
 
-func showRunCmd(cmd *cobra.Command, args []string) {
+func infoRunCmd(cmd *cobra.Command, args []string) {
 	reqRepoName := ""
 	if len(args) >= 1 {
 		reqRepoName = strings.TrimPrefix(args[0], "@")
@@ -191,31 +187,16 @@ func AddProjectCommands(cmd *cobra.Command) {
 
 	cmd.AddCommand(newCmd)
 
-	// Top level project command.
-	projectHelpText := ""
-	projectHelpEx := ""
-	projectCmd := &cobra.Command{
-		Use:     "project",
-		Short:   "Display information about your project",
-		Long:    projectHelpText,
-		Example: projectHelpEx,
-		Run: func(cmd *cobra.Command, args []string) {
-			cmd.Usage()
-		},
-	}
-
-	cmd.AddCommand(projectCmd)
-
-	showHelpText := "Show information about the project."
-	showHelpEx := "  newt pkg show\n"
+	infoHelpText := "Show information about the current project."
+	infoHelpEx := "  newt info\n"
 
-	showCmd := &cobra.Command{
-		Use:     "show [repo-name|all]",
+	infoCmd := &cobra.Command{
+		Use:     "info",
 		Short:   "Show project info",
-		Long:    showHelpText,
-		Example: showHelpEx,
-		Run:     showRunCmd,
+		Long:    infoHelpText,
+		Example: infoHelpEx,
+		Run:     infoRunCmd,
 	}
 
-	projectCmd.AddCommand(showCmd)
+	cmd.AddCommand(infoCmd)
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/a1f800eb/newt/downloader/downloader.go
----------------------------------------------------------------------
diff --git a/newt/downloader/downloader.go b/newt/downloader/downloader.go
index a4e0197..8becfbc 100644
--- a/newt/downloader/downloader.go
+++ b/newt/downloader/downloader.go
@@ -92,7 +92,7 @@ func (gd *GithubDownloader) DownloadRepo(branch string) (string, error)
{
 	}
 
 	url := fmt.Sprintf("https://github.com/%s/%s.git", gd.User, gd.Repo)
-	util.StatusMessage(util.VERBOSITY_DEFAULT, fmt.Sprintf("Downloading "+
+	util.StatusMessage(util.VERBOSITY_VERBOSE, fmt.Sprintf("Downloading "+
 		"repository %s (branch: %s) at %s\n", gd.Repo, branch, url))
 
 	gitPath, err := exec.LookPath("git")

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/a1f800eb/newt/project/project.go
----------------------------------------------------------------------
diff --git a/newt/project/project.go b/newt/project/project.go
index 0c260f2..f8b079e 100644
--- a/newt/project/project.go
+++ b/newt/project/project.go
@@ -197,13 +197,13 @@ func (proj *Project) upgradeCheck(r *repo.Repo, vers *repo.Version,
 			// Anything but no means yes.
 			answer := strings.ToUpper(strings.Trim(string(line), " "))
 			if answer == "N" || answer == "NO" {
-				fmt.Printf("Users says don't upgrade, skipping upgrade of %s\n",
+				fmt.Printf("User says don't upgrade, skipping upgrade of %s\n",
 					r.Name())
 				return true, nil
 			}
 		}
 	} else {
-		util.StatusMessage(util.VERBOSITY_DEFAULT,
+		util.StatusMessage(util.VERBOSITY_VERBOSE,
 			"Repository %s doesn't need to be upgraded, latest "+
 				"version installed.\n", r.Name())
 		return true, nil
@@ -232,10 +232,7 @@ func (proj *Project) checkVersionRequirements(r *repo.Repo, upgrade bool,
force
 			return true, err
 		} else {
 			if !upgrade {
-				util.StatusMessage(util.VERBOSITY_DEFAULT,
-					fmt.Sprintf("Installed repository %s has version %s, "+
-						"which meets project requirements. Moving on to next repository.\n",
-						r.Name(), vers))
+				util.StatusMessage(util.VERBOSITY_VERBOSE, "%s correct version already installed\n",
r.Name())
 				return true, nil
 			} else {
 				skip, err := proj.upgradeCheck(r, vers, force)
@@ -341,6 +338,14 @@ func (proj *Project) Install(upgrade bool, force bool) error {
 			return err
 		}
 
+		if upgrade {
+			util.StatusMessage(util.VERBOSITY_VERBOSE, "%s successfully upgraded to version %s\n",
+				r.Name(), rvers.String())
+		} else {
+			util.StatusMessage(util.VERBOSITY_VERBOSE, "%s successfully installed version %s\n",
+				r.Name(), rvers.String())
+		}
+
 		// Update the project state with the new repository version information.
 		proj.projState.Replace(rname, rvers)
 	}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/a1f800eb/newt/repo/repo.go
----------------------------------------------------------------------
diff --git a/newt/repo/repo.go b/newt/repo/repo.go
index 0eba750..50b83ab 100644
--- a/newt/repo/repo.go
+++ b/newt/repo/repo.go
@@ -320,6 +320,8 @@ func (r *Repo) UpdateDesc() ([]*Repo, bool, error) {
 		return nil, false, nil
 	}
 
+	util.StatusMessage(util.VERBOSITY_DEFAULT, "%s\n", r.Name())
+
 	if err = r.DownloadDesc(); err != nil {
 		return nil, false, err
 	}
@@ -338,7 +340,7 @@ func (r *Repo) UpdateDesc() ([]*Repo, bool, error) {
 func (r *Repo) DownloadDesc() error {
 	dl := r.downloader
 
-	util.StatusMessage(util.VERBOSITY_DEFAULT, fmt.Sprintf("Downloading "+
+	util.StatusMessage(util.VERBOSITY_VERBOSE, fmt.Sprintf("Downloading "+
 		"repository description for %s...", r.Name()))
 
 	// Configuration path
@@ -352,11 +354,11 @@ func (r *Repo) DownloadDesc() error {
 	dl.SetBranch("master")
 	if err := dl.FetchFile("repository.yml",
 		cpath+"/"+"repository.yml"); err != nil {
-		util.StatusMessage(util.VERBOSITY_DEFAULT, " failed\n")
+		util.StatusMessage(util.VERBOSITY_VERBOSE, " failed\n")
 		return err
 	}
 
-	util.StatusMessage(util.VERBOSITY_DEFAULT, " success!\n")
+	util.StatusMessage(util.VERBOSITY_VERBOSE, " success!\n")
 
 	return nil
 }


Mime
View raw message