Better sanitize user input in inputInt

This commit is contained in:
2024-03-08 11:23:08 -05:00
parent 8e1987f250
commit f8bf12677f
4 changed files with 17 additions and 6 deletions
+6
View File
@@ -1,7 +1,9 @@
package cli
import (
"fmt"
"github.com/rwinkhart/MUTN/src/offline"
"os"
)
// TempInitCli initializes the MUTN environment based on user input
@@ -14,6 +16,10 @@ func TempInitCli() {
// select GPG key from menu
uidSlice := offline.GpgUIDListGen()
gpgIDInt := inputMenuGen("Select GPG key:", uidSlice)
if gpgIDInt == 0 {
fmt.Println(offline.AnsiError + "No GPG keys found - please generate one" + offline.AnsiReset)
os.Exit(1)
}
gpgID = uidSlice[gpgIDInt-1]
}