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


The following commit(s) were added to refs/heads/master by this push:
     new 966db465 newt: Add ignore flag for upgrade command
966db465 is described below

commit 966db4653181636069571746a10a0fda8d2dc4f0
Author: Michal Gorecki <[email protected]>
AuthorDate: Thu Oct 24 18:43:40 2024 +0200

    newt: Add ignore flag for upgrade command
    
    This adds --ignore or -i flag for upgrade command.
    Flags arguments should specify names of repositories
    that will be ignored while upgrading, separated by a comma
    or by using multiple -i flags
    For example:
    newt upgrade -i apache-mynewt-nimble -i 
stm-cmsis_device_f3,stm-stm32f3xx_hal_driver
---
 newt/cli/project_cmds.go  | 2 ++
 newt/newtutil/newtutil.go | 1 +
 newt/project/project.go   | 1 +
 3 files changed, 4 insertions(+)

diff --git a/newt/cli/project_cmds.go b/newt/cli/project_cmds.go
index 9a742462..a14f796b 100644
--- a/newt/cli/project_cmds.go
+++ b/newt/cli/project_cmds.go
@@ -214,6 +214,8 @@ func AddProjectCommands(cmd *cobra.Command) {
                "Force upgrade of the repositories to latest state in 
project.yml")
        upgradeCmd.PersistentFlags().BoolVarP(&newtutil.NewtAsk,
                "ask", "a", false, "Prompt user before upgrading any repos")
+       upgradeCmd.PersistentFlags().StringSliceVarP(&newtutil.NewtIgnore, 
"ignore", "i", []string{},
+               "Names of repositories to skip, separated by a comma or by 
using multiple flags")
 
        cmd.AddCommand(upgradeCmd)
 
diff --git a/newt/newtutil/newtutil.go b/newt/newtutil/newtutil.go
index 9e129e67..8544f139 100644
--- a/newt/newtutil/newtutil.go
+++ b/newt/newtutil/newtutil.go
@@ -39,6 +39,7 @@ var NewtBlinkyTag string = "master"
 var NewtNumJobs int
 var NewtForce bool
 var NewtAsk bool
+var NewtIgnore []string
 
 const CORE_REPO_NAME string = "apache-mynewt-core"
 const ARDUINO_ZERO_REPO_NAME string = "mynewt_arduino_zero"
diff --git a/newt/project/project.go b/newt/project/project.go
index e4f4bae9..0ce045af 100644
--- a/newt/project/project.go
+++ b/newt/project/project.go
@@ -634,6 +634,7 @@ func (proj *Project) loadConfig(download bool) error {
        proj.reposIgnored = make([]string, 0)
        proj.reposIgnored, err = 
yc.GetValStringSlice("project.repositories.ignored", nil)
        util.OneTimeWarningError(err)
+       proj.reposIgnored = append(proj.reposIgnored, newtutil.NewtIgnore...)
 
        if util.SliceContains(proj.reposIgnored, "apache-mynewt-core") {
                return util.NewNewtError("apache-mynewt-core repository can't 
be ignored. " +

Reply via email to