Skip to content

Commit f68b622

Browse files
committed
Add additional CLI args
1 parent c683283 commit f68b622

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

SupportCompanionCLI/main.swift

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ struct SupportCompanionCLI {
4343
getStorageInfo()
4444
case "mdm":
4545
await getMDMInfo()
46+
case "user":
47+
await getUserInfo()
48+
case "kerberos":
49+
await getKerberosSSOInfo()
50+
case "psso":
51+
await getPSSOInfo()
4652
case "help":
4753
printUsage()
4854
default:
@@ -212,6 +218,62 @@ struct SupportCompanionCLI {
212218
Time Remaining: \(timeRemaining)
213219
""")
214220
}
221+
222+
static func getUserInfo() async {
223+
let userInfoHelper = UserInfoHelper()
224+
do {
225+
let userInfo = try await userInfoHelper.fetchUserInfo()
226+
print("""
227+
👤 User Information
228+
-----------------------
229+
Login: \(userInfo.login)
230+
Name: \(userInfo.name)
231+
Home Directory: \(userInfo.homeDir)
232+
Shell: \(userInfo.shell)
233+
Admin: \(userInfo.isAdmin ? "Yes" : "No")
234+
""")
235+
} catch {
236+
print("Failed to fetch user information: \(error.localizedDescription)")
237+
}
238+
}
239+
240+
static func getKerberosSSOInfo() async {
241+
do {
242+
let kerberosHelper = SSOInfoHelpers()
243+
let kerberosInfo = try await kerberosHelper.fetchKerberosSSO()
244+
print("""
245+
🎟 Kerberos SSO Information
246+
-----------------------
247+
Username: \(kerberosInfo.username)
248+
Realm: \(kerberosInfo.realm)
249+
Password Expires: \(kerberosInfo.expiryDays) days
250+
Last Password Change: \(kerberosInfo.lastSSOPasswordChangeDays) days
251+
Last Local Password Change: \(kerberosInfo.lastLocalPasswordChangeDays) days
252+
""")
253+
} catch {
254+
print("Failed to fetch Kerberos SSO information: \(error.localizedDescription)")
255+
}
256+
}
257+
258+
static func getPSSOInfo() async {
259+
do {
260+
let ssoHelper = SSOInfoHelpers()
261+
let ssoInfo = try await ssoHelper.fetchPlatformSSO()
262+
print("""
263+
🎟 Platform SSO Information
264+
-----------------------
265+
Login Frequency: \(ssoInfo.loginFrequency)
266+
Login Type: \(ssoInfo.loginType)
267+
New User Autorization Mode: \(ssoInfo.newUserAuthorizationMode)
268+
Registration Completed: \(ssoInfo.registrationCompleted)
269+
SDK Version: \(ssoInfo.sdkVersionString)
270+
Shared Device Keys: \(ssoInfo.sharedDeviceKeys)
271+
User Authorization Mode: \(ssoInfo.userAuthorizationMode)
272+
""")
273+
} catch {
274+
print("Failed to fetch Platform SSO information: \(error.localizedDescription)")
275+
}
276+
}
215277

216278
static func printUsage() {
217279
print("""
@@ -226,6 +288,9 @@ struct SupportCompanionCLI {
226288
device Output device information.
227289
storage Output storage information.
228290
mdm Output MDM information.
291+
user Output user information.
292+
kerberos Output Kerberos SSO information.
293+
psso Output Platform SSO information.
229294
help Show this help message.
230295
""")
231296
}

0 commit comments

Comments
 (0)