diff --git a/Native/MBoxWorkspace/CLI/Exec.swift b/Native/MBoxWorkspace/CLI/Exec.swift index 2e81a3c..9b03cff 100644 --- a/Native/MBoxWorkspace/CLI/Exec.swift +++ b/Native/MBoxWorkspace/CLI/Exec.swift @@ -90,7 +90,10 @@ extension MBCommander { dynamic open func reposToRun() -> [MBConfig.Repo] { - let repos = self.config.currentFeature.repos + return self.filterRepos(repos: self.config.currentFeature.repos) + } + + open func filterRepos(repos: [MBConfig.Repo]) -> [MBConfig.Repo] { if self.inRepos == nil && self.noRepos == nil { return repos } return repos.filter { repo -> Bool in return (self.inRepos?.any(matching: { repo.isName($0) }) ?? true) && diff --git a/Native/MBoxWorkspace/CLI/Feature/import.swift b/Native/MBoxWorkspace/CLI/Feature/import.swift index f92f3c9..d59ae42 100644 --- a/Native/MBoxWorkspace/CLI/Feature/import.swift +++ b/Native/MBoxWorkspace/CLI/Feature/import.swift @@ -68,10 +68,15 @@ extension MBCommander.Feature { dynamic open override func validate() throws { try super.validate() - self.feature = try MBConfig.Feature.load(fromString: self.json, coder: .json) + self.feature = try self.buildFeature(fromString: self.json) try self.validateBranch() } + dynamic + open func buildFeature(fromString string: String) throws -> MBConfig.Feature { + return try MBConfig.Feature.load(fromString: string, coder: .json) + } + open func setupName() throws { if let name = self.name { self.feature.name = name diff --git a/Native/MBoxWorkspaceCore/Model/MBConfig.Feature+Repo.swift b/Native/MBoxWorkspaceCore/Model/MBConfig.Feature+Repo.swift index c2132a7..18900ec 100644 --- a/Native/MBoxWorkspaceCore/Model/MBConfig.Feature+Repo.swift +++ b/Native/MBoxWorkspaceCore/Model/MBConfig.Feature+Repo.swift @@ -50,6 +50,7 @@ extension MBConfig.Feature { } @discardableResult + dynamic open func merge(feature: MBConfig.Feature) -> [MBConfig.Repo] { var addedRepos = [MBConfig.Repo]() feature.repos.forEach { repo in