Skip to content

Commit

Permalink
Merge pull request #10 from rofle100lvl/RefactoringBranch
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
rofle100lvl authored Oct 11, 2024
2 parents 94ceb0c + aaf6221 commit f72c9bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
5 changes: 1 addition & 4 deletions Sources/UseGraphPeriphery/UseGraphDynamic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,9 @@ public struct UseGraphPeripheryBuildCommand: AsyncParsableCommand {
@Option(help: "Path to project (.xcodeproj)")
var projectPath: String? = nil

@Argument(help: "Schemes to analyze")
@Option(help: "Schemes to analyze")
var schemes: String

@Argument(help: "Targets to analyze")
var targets: String

public func run() async throws {
let configuration = Configuration()
if let projectPath {
Expand Down
30 changes: 8 additions & 22 deletions Sources/UseGraphPeriphery/UseGraphPeripheryCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,25 @@ public struct UseGraphPeripheryAnalyzeCommand: AsyncParsableCommand {
version: "0.0.1"
)

@Argument(help: "Path to project (.xcodeproj)")
@Option(help: "Path to project (.xcodeproj)")
var projectPath: String? = nil

@Argument(help: "Paths to folder with sources - \"path1,path2,path3\"")
var folderPaths: String? = nil
@Option(help: "Paths to folder with sources - \"path1,path2,path3\"")
var folderPaths: String

@Argument(help: "Schemes to analyze")
@Option(help: "Schemes to analyze")
var schemes: String

@Argument(help: "Targets to analyze")
var targets: String

@Option(help: "Use if you want to exclude any entity names")
var excludedNames: String? = nil

@Option(help: "Use if you want to exclude any targets")
var excludedTargets: String? = nil

public func run() async throws {
var projectURL: URL?
var folderURLs: [String] = []
let folderURLs: [String] = try folderPaths.split(separator: ",").map {
guard let folderURL = URL(string: String($0)) else { throw PathError.pathIsNotCorrect }
return folderURL.path()
}

if let projectPath {
projectURL = URL(string: projectPath)
}
if let folderPaths {
folderURLs = try folderPaths.split(separator: ",").map {
guard let folderURL = URL(string: String($0)) else { throw PathError.pathIsNotCorrect }
return folderURL.path()
}
} else {
throw PathError.pathIsNotCorrect
}

guard let projectURL else { throw PathError.pathIsNotCorrect }
let configuration = Configuration()
Expand Down

0 comments on commit f72c9bc

Please sign in to comment.