Skip to content

Commit 966db46

Browse files
m-goreckiandrzej-kaczmarek
authored andcommitted
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
1 parent dab1723 commit 966db46

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

newt/cli/project_cmds.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ func AddProjectCommands(cmd *cobra.Command) {
214214
"Force upgrade of the repositories to latest state in project.yml")
215215
upgradeCmd.PersistentFlags().BoolVarP(&newtutil.NewtAsk,
216216
"ask", "a", false, "Prompt user before upgrading any repos")
217+
upgradeCmd.PersistentFlags().StringSliceVarP(&newtutil.NewtIgnore, "ignore", "i", []string{},
218+
"Names of repositories to skip, separated by a comma or by using multiple flags")
217219

218220
cmd.AddCommand(upgradeCmd)
219221

newt/newtutil/newtutil.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var NewtBlinkyTag string = "master"
3939
var NewtNumJobs int
4040
var NewtForce bool
4141
var NewtAsk bool
42+
var NewtIgnore []string
4243

4344
const CORE_REPO_NAME string = "apache-mynewt-core"
4445
const ARDUINO_ZERO_REPO_NAME string = "mynewt_arduino_zero"

newt/project/project.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ func (proj *Project) loadConfig(download bool) error {
634634
proj.reposIgnored = make([]string, 0)
635635
proj.reposIgnored, err = yc.GetValStringSlice("project.repositories.ignored", nil)
636636
util.OneTimeWarningError(err)
637+
proj.reposIgnored = append(proj.reposIgnored, newtutil.NewtIgnore...)
637638

638639
if util.SliceContains(proj.reposIgnored, "apache-mynewt-core") {
639640
return util.NewNewtError("apache-mynewt-core repository can't be ignored. " +

0 commit comments

Comments
 (0)