File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 errConvertPort = errors .New (`cannot convert port` )
1919)
2020
21+ // Run Main function that runs an interactive form to collect SSH connection details
2122func Run () (* Fields , error ) {
2223 var authPassConfirm bool
2324
Original file line number Diff line number Diff line change 11package create
22
3+ // Fields A struct that stores SSH connection details
34type Fields struct {
45 Alias string
56 Login string
Original file line number Diff line number Diff line change 2727 errPreloadedConnections error
2828)
2929
30+ // init Loads existing SSH connections at startup
3031func init () {
3132 connections , err := kernel .List ()
3233 if err != nil {
@@ -36,6 +37,7 @@ func init() {
3637 preloadedConnections = connections
3738}
3839
40+ // aliasValidate validate on exists alias
3941func aliasValidate (alias string ) error {
4042 if strings .TrimSpace (alias ) == "" || alias == "" {
4143 return errAliasIsNotEmpty
@@ -54,6 +56,7 @@ func aliasValidate(alias string) error {
5456 return nil
5557}
5658
59+ // portValidate validate on correctly port
5760func portValidate (s string ) error {
5861 port , err := strconv .Atoi (s )
5962 if err != nil {
@@ -67,6 +70,7 @@ func portValidate(s string) error {
6770 return nil
6871}
6972
73+ // privateKeyValidate validate on exists file
7074func privateKeyValidate (filename string ) error {
7175 if strings .TrimSpace (filename ) == "" || filename == "" {
7276 return nil
Original file line number Diff line number Diff line change 1111 errNotFoundConnections = errors .New ("not found connections" )
1212)
1313
14+ // Run Get selected connection from list
1415func Run (connections * connect.Connections ) (* connect.Connect , error ) {
1516 var aliases []string
1617 var selectedAlias string
Original file line number Diff line number Diff line change 66 ErrorColor = lipgloss .Color ("#FF0000" )
77)
88
9+ // Error get message line for erros
910func Error (s string ) {
1011 style := lipgloss .NewStyle ().Foreground (ErrorColor )
1112 println (style .Render (s ))
Original file line number Diff line number Diff line change 66 successColor = lipgloss .Color ("#04B575" )
77)
88
9+ // Success get message lin for success operations
910func Success (s string ) {
1011 style := lipgloss .NewStyle ().Foreground (successColor )
1112 println (style .Render (s ))
Original file line number Diff line number Diff line change 11package update
22
3+ // Fields A struct that update SSH connection details
34type Fields struct {
45 Alias string
56 Login string
Original file line number Diff line number Diff line change 1515 errConvertPort = errors .New (`cannot convert port` )
1616)
1717
18+ // Run get form for update connect.Connect
1819func Run (connection * connect.Connect ) (* Fields , error ) {
1920 var authPassConfirm bool
2021
Original file line number Diff line number Diff line change 2727 errPreloadedConnections error
2828)
2929
30+ // init Loads existing SSH connections at startup
3031func init () {
3132 connections , err := kernel .List ()
3233 if err != nil {
@@ -36,6 +37,7 @@ func init() {
3637 preloadedConnections = connections
3738}
3839
40+ // aliasValidate validate on exists alias
3941func aliasValidate (alias string ) error {
4042 if strings .TrimSpace (alias ) == "" || alias == "" {
4143 return errAliasIsNotEmpty
@@ -54,6 +56,7 @@ func aliasValidate(alias string) error {
5456 return nil
5557}
5658
59+ // portValidate validate on correctly port
5760func portValidate (s string ) error {
5861 port , err := strconv .Atoi (s )
5962 if err != nil {
@@ -67,6 +70,7 @@ func portValidate(s string) error {
6770 return nil
6871}
6972
73+ // privateKeyValidate validate on exists file
7074func privateKeyValidate (filename string ) error {
7175 if strings .TrimSpace (filename ) == "" || filename == "" {
7276 return nil
You can’t perform that action at this time.
0 commit comments