MCPcopy Create free account
hub / github.com/Mister-leo/fssh / runInteractiveSetup

Function runInteractiveSetup

cmd/fssh/setup.go:15–85  ·  view source on GitHub ↗

runInteractiveSetup orchestrates the complete interactive setup wizard

(force bool, seedTTL int, algorithm string, digits int)

Source from the content-addressed store, hash-verified

13
14// runInteractiveSetup orchestrates the complete interactive setup wizard
15func runInteractiveSetup(force bool, seedTTL int, algorithm string, digits int) {
16 printWelcome()
17
18 // Step 1: Check if already initialized
19 if err := checkInitialization(force); err != nil {
20 fatal(err)
21 }
22
23 // Step 2: Choose authentication mode
24 authMode, err := promptAuthMode()
25 if err != nil {
26 fatal(err)
27 }
28
29 // Step 3: Execute authentication initialization
30 fmt.Println()
31 printStepHeader(3, 8, "Initialize Authentication")
32 if authMode == "touchid" {
33 initTouchIDMode(force)
34 } else {
35 initOTPMode(force, seedTTL, algorithm, digits)
36 }
37
38 // Step 4: Binary installation
39 fmt.Println()
40 printStepHeader(4, 8, "Binary Installation")
41 if err := ensureBinaryInstalled(); err != nil {
42 fmt.Printf("⚠️ Warning: Binary installation failed: %v\n", err)
43 fmt.Println("You can install manually with:")
44 fmt.Println(" sudo cp fssh /usr/local/bin/")
45 fmt.Println()
46 }
47
48 // Step 5: Import SSH keys
49 fmt.Println()
50 printStepHeader(5, 8, "Import SSH Keys")
51 if err := importSSHKeys(); err != nil {
52 fmt.Printf("⚠️ Warning: SSH key import failed: %v\n", err)
53 fmt.Println("You can import keys later with: fssh import")
54 fmt.Println()
55 }
56
57 // Step 6: Configure LaunchAgent
58 fmt.Println()
59 printStepHeader(6, 8, "Configure LaunchAgent (Auto-start)")
60 if err := setupLaunchAgent(); err != nil {
61 fmt.Printf("⚠️ Warning: LaunchAgent setup failed: %v\n", err)
62 fmt.Println("You can configure manually later")
63 fmt.Println()
64 }
65
66 // Step 7: Start Agent
67 fmt.Println()
68 printStepHeader(7, 8, "Start SSH Agent")
69 if err := startAgent(); err != nil {
70 fmt.Printf("⚠️ Warning: Agent startup failed: %v\n", err)
71 fmt.Println("You can start manually with: fssh agent")
72 fmt.Println()

Callers 1

cmdInitFunction · 0.85

Calls 13

printWelcomeFunction · 0.85
checkInitializationFunction · 0.85
fatalFunction · 0.85
promptAuthModeFunction · 0.85
printStepHeaderFunction · 0.85
initTouchIDModeFunction · 0.85
initOTPModeFunction · 0.85
ensureBinaryInstalledFunction · 0.85
importSSHKeysFunction · 0.85
setupLaunchAgentFunction · 0.85
startAgentFunction · 0.85
addToSSHConfigFunction · 0.85

Tested by

no test coverage detected