Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/develop 745efe956 -> 8728a73e2


MYNEWT-639 Add help text and check for pkg name
1) Update help text for "newt pkg new" to have package name input.
2) Error check that a package name is provided for the command.
3) Changed "libs/mylib" to "sys/mylib" in "newt pkg" help text to reflect 
latest source structure.
   (this change is not related to MYNEWT-639)
4) Added <package-name> argument to "newt pkg remove" Usage help text


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/14b40595
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/14b40595
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/14b40595

Branch: refs/heads/develop
Commit: 14b40595477fab94b099691ef7e18c37c7dcb606
Parents: 745efe9
Author: cwanda <[email protected]>
Authored: Fri Feb 24 22:15:46 2017 -0800
Committer: cwanda <[email protected]>
Committed: Sat Feb 25 11:44:35 2017 -0800

----------------------------------------------------------------------
 newt/cli/pkg_cmds.go | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/14b40595/newt/cli/pkg_cmds.go
----------------------------------------------------------------------
diff --git a/newt/cli/pkg_cmds.go b/newt/cli/pkg_cmds.go
index 0ddde3d..d17e81f 100644
--- a/newt/cli/pkg_cmds.go
+++ b/newt/cli/pkg_cmds.go
@@ -37,6 +37,15 @@ import (
 var NewTypeStr = "pkg"
 
 func pkgNewCmd(cmd *cobra.Command, args []string) {
+
+       if len(args) == 0 {
+               NewtUsage(cmd, util.NewNewtError("Must specify a package name"))
+       }
+
+       if len(args) != 1 {
+               NewtUsage(cmd, util.NewNewtError("Exactly one argument 
required"))
+       }
+
        NewTypeStr = strings.ToUpper(NewTypeStr)
 
        pw := project.NewPackageWriter()
@@ -51,11 +60,11 @@ func pkgNewCmd(cmd *cobra.Command, args []string) {
 type dirOperation func(string, string) error
 
 func pkgCloneCmd(cmd *cobra.Command, args []string) {
-       pkgCloneOrMoveCmd(cmd, args, util.CopyDir, "Cloning");
+       pkgCloneOrMoveCmd(cmd, args, util.CopyDir, "Cloning")
 }
 
 func pkgMoveCmd(cmd *cobra.Command, args []string) {
-       pkgCloneOrMoveCmd(cmd, args, util.MoveDir, "Moving");
+       pkgCloneOrMoveCmd(cmd, args, util.MoveDir, "Moving")
 }
 
 func pkgCloneOrMoveCmd(cmd *cobra.Command, args []string, dirOpFn 
dirOperation, opStr string) {
@@ -207,7 +216,7 @@ func AddPackageCommands(cmd *cobra.Command) {
         * keyed
         */
        pkgHelpText := "Commands for creating and manipulating packages"
-       pkgHelpEx := "  newt pkg new --type=pkg libs/mylib"
+       pkgHelpEx := "  newt pkg new --type=pkg sys/mylib"
 
        pkgCmd := &cobra.Command{
                Use:     "pkg",
@@ -226,8 +235,8 @@ func AddPackageCommands(cmd *cobra.Command) {
        newCmdHelpEx := ""
 
        newCmd := &cobra.Command{
-               Use:     "new",
-               Short:   "Create a new package, from a template",
+               Use:     "new <package-name>",
+               Short:   "Create a new package in the current directory, from a 
template",
                Long:    newCmdHelpText,
                Example: newCmdHelpEx,
                Run:     pkgNewCmd,
@@ -268,7 +277,7 @@ func AddPackageCommands(cmd *cobra.Command) {
        removeCmdHelpEx := ""
 
        removeCmd := &cobra.Command{
-               Use:     "remove",
+               Use:     "remove <package-name>",
                Short:   "Remove a package",
                Long:    removeCmdHelpText,
                Example: removeCmdHelpEx,

Reply via email to