Modern Apps git

← xtool.git

Run setup during new

Commit
4cb0b5daf4dfe2cde24a168e924b3559ae6ec4ee
Author
Kabir Oberai <[email protected]>
When
2025-04-25 23:01 UTC (1 year ago)
Parents
ddc1cd5

Diff

Sources/SupersignCLISupport/AuthCommand.swift
diff --git a/Sources/SupersignCLISupport/AuthCommand.swift b/Sources/SupersignCLISupport/AuthCommand.swiftindex f42f0c1..bbbd5ef 100644--- a/Sources/SupersignCLISupport/AuthCommand.swift+++ b/Sources/SupersignCLISupport/AuthCommand.swift@@ -22,10 +22,13 @@ struct AuthOperation {     var logoutFromExisting: Bool      var mode: AuthMode? = nil+    var quiet = false      func run() async throws {         if let token = try? AuthToken.saved(), !logoutFromExisting {-            print("Logged in.\n\(token)")+            if !quiet {+                print("Logged in.\n\(token)")+            }             return         } 
Sources/SupersignCLISupport/DevCommands/DevCommand.swift
diff --git a/Sources/SupersignCLISupport/DevCommands/DevCommand.swift b/Sources/SupersignCLISupport/DevCommands/DevCommand.swiftindex b62e287..5aae43b 100644--- a/Sources/SupersignCLISupport/DevCommands/DevCommand.swift+++ b/Sources/SupersignCLISupport/DevCommands/DevCommand.swift@@ -15,9 +15,27 @@ struct DevSetupCommand: AsyncParsableCommand {     )      func run() async throws {-        try await AuthOperation(logoutFromExisting: false).run()+        try await DevSetupOperation().run()+    }+} -        if try DarwinSDK.current() == nil {+struct DevSetupOperation {+    var quiet = false++    func run() async throws {+        try await AuthOperation(logoutFromExisting: false, quiet: quiet).run()++        switch try DarwinSDK.current()?.isUpToDate() {+        case true?:+            if !quiet {+                print("Darwin SDK is up to date.")+            }+        case false?:+            if !quiet {+                print("Darwin SDK is outdated.")+            }+            fallthrough+        case nil:             let path = try await Console.prompt("""             Now generating the Darwin SDK.             
Sources/SupersignCLISupport/DevCommands/DevNewCommand.swift
diff --git a/Sources/SupersignCLISupport/DevCommands/DevNewCommand.swift b/Sources/SupersignCLISupport/DevCommands/DevNewCommand.swiftindex e2f3b1c..ae63955 100644--- a/Sources/SupersignCLISupport/DevCommands/DevNewCommand.swift+++ b/Sources/SupersignCLISupport/DevCommands/DevNewCommand.swift@@ -10,7 +10,23 @@ struct DevNewCommand: AsyncParsableCommand {      @Argument var name: String? +    @Flag(+        help: ArgumentHelp(+            "Skip setup steps. (default: false)",+            discussion: """+            By default, this command first invokes `supersign dev setup` to complete \+            any missing setup steps, like authenticating and installing the SDK. Use \+            this flag to always skip setup.+            """+        )+    ) var skipSetup = false+     func run() async throws {+        if !skipSetup {+            // perform any remaining setup steps first+            try await DevSetupOperation(quiet: true).run()+        }+         let name = try await Console.promptRequired("Package name: ", existing: self.name)          var allowedFirstCharacters: CharacterSet = ["_"]
Sources/SupersignCLISupport/DevCommands/DevSDKCommand.swift
diff --git a/Sources/SupersignCLISupport/DevCommands/DevSDKCommand.swift b/Sources/SupersignCLISupport/DevCommands/DevSDKCommand.swiftindex 26a0fd7..01b8697 100644--- a/Sources/SupersignCLISupport/DevCommands/DevSDKCommand.swift+++ b/Sources/SupersignCLISupport/DevCommands/DevSDKCommand.swift@@ -157,6 +157,10 @@ struct DarwinSDK {         }     } +    func isUpToDate() -> Bool {+        true+    }+     func remove() throws {         try FileManager.default.removeItem(at: bundle)     }