refactor: seperate files, function and structs into seperate packages
This commit is contained in:
parent
7f951585c8
commit
5b7775f33e
37 changed files with 547 additions and 677 deletions
32
utils/utils.go
Normal file
32
utils/utils.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/charmbracelet/huh"
|
||||
)
|
||||
|
||||
func GetSudoPassword() (string, error) {
|
||||
var password string
|
||||
form := huh.NewForm(
|
||||
huh.NewGroup(
|
||||
huh.NewInput().
|
||||
Title("Bitte geben Sie Ihr sudo-Passwort ein").
|
||||
EchoMode(huh.EchoModePassword).
|
||||
Value(&password),
|
||||
),
|
||||
).WithTheme(huh.ThemeCatppuccin())
|
||||
|
||||
err := form.Run()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("fehler bei der Passwortabfrage: %v", err)
|
||||
}
|
||||
return password, nil
|
||||
}
|
||||
|
||||
func max(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue