sshtunnel/main.go

28 lines
533 B
Go

package main
import (
"fmt"
"os"
"git.mvl.sh/vleeuwenmenno/sshtunnel/cmd"
)
func main() {
// Ensure tunnel directory exists
homeDir, err := os.UserHomeDir()
if err != nil {
fmt.Printf("Error getting home directory: %v\n", err)
os.Exit(1)
}
tunnelPath := homeDir + "/.sshtunnels"
if _, err := os.Stat(tunnelPath); os.IsNotExist(err) {
err = os.MkdirAll(tunnelPath, 0755)
if err != nil {
fmt.Printf("Error creating tunnel directory: %v\n", err)
os.Exit(1)
}
}
// Execute the root command
cmd.Execute()
}