You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/03/11 23:53:41 UTC
incubator-mynewt-newt git commit: Add "target vars" command: shows
valid var names.
Repository: incubator-mynewt-newt
Updated Branches:
refs/heads/develop 1251fac9c -> f34bd3f8a
Add "target vars" command: shows valid var names.
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/f34bd3f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/f34bd3f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/f34bd3f8
Branch: refs/heads/develop
Commit: f34bd3f8a9cef1bf24c9c6fe110a0cf254aa6875
Parents: 1251fac
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Mar 11 14:53:19 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Mar 11 14:53:19 2016 -0800
----------------------------------------------------------------------
newt/cli/target_cmds.go | 37 +++++++++++++++++++++++++++++++++++++
newt/target/vars.go | 2 ++
2 files changed, 39 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/f34bd3f8/newt/cli/target_cmds.go
----------------------------------------------------------------------
diff --git a/newt/cli/target_cmds.go b/newt/cli/target_cmds.go
index 9d88026..3f078ab 100644
--- a/newt/cli/target_cmds.go
+++ b/newt/cli/target_cmds.go
@@ -338,6 +338,30 @@ func targetCopyCmd(cmd *cobra.Command, args []string) {
}
}
+func targetVarsCmd(cmd *cobra.Command, args []string) {
+ varNames := []string{
+ "target.app",
+ "target.bsp",
+ "target.build_profile",
+ "target.features",
+ }
+
+ util.StatusMessage(util.VERBOSITY_DEFAULT, "The following target "+
+ "variables are recognized:\n")
+ for _, varName := range varNames {
+ util.StatusMessage(util.VERBOSITY_DEFAULT, " * %s\n",
+ strings.TrimPrefix(varName, "target."))
+
+ varValues, err := target.VarValues(varName)
+ if err == nil {
+ for _, varValue := range varValues {
+ util.StatusMessage(util.VERBOSITY_VERBOSE, " * %s\n",
+ varValue)
+ }
+ }
+ }
+}
+
func AddTargetCommands(cmd *cobra.Command) {
targetHelpText := ""
targetHelpEx := ""
@@ -428,4 +452,17 @@ func AddTargetCommands(cmd *cobra.Command) {
}
targetCmd.AddCommand(copyCmd)
+
+ varsHelpText := "Displays a list of valid target variable names"
+ varsHelpEx := " newt target vars\n"
+
+ varsCmd := &cobra.Command{
+ Use: "vars",
+ Short: "Show variable names",
+ Long: varsHelpText,
+ Example: varsHelpEx,
+ Run: targetVarsCmd,
+ }
+
+ targetCmd.AddCommand(varsCmd)
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/f34bd3f8/newt/target/vars.go
----------------------------------------------------------------------
diff --git a/newt/target/vars.go b/newt/target/vars.go
index 62c4c0b..1e7257b 100644
--- a/newt/target/vars.go
+++ b/newt/target/vars.go
@@ -17,6 +17,8 @@
* under the License.
*/
+// XXX: This should be moved to the cli package.
+
package target
import (