-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change colors and add logout, support info, env section, update texts…
… and ux
- Loading branch information
krls
committed
Apr 23, 2024
1 parent
901c44b
commit b08022b
Showing
10 changed files
with
230 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/zeropsio/zcli/src/cmdBuilder" | ||
"github.com/zeropsio/zcli/src/i18n" | ||
"github.com/zeropsio/zcli/src/constants" | ||
"github.com/zeropsio/zcli/src/uxBlock" | ||
"github.com/zeropsio/zcli/src/uxBlock/styles" | ||
) | ||
|
||
var env string | ||
|
||
func envCmd() *cmdBuilder.Cmd { | ||
return cmdBuilder.NewCmd(). | ||
Use("env"). | ||
Short(i18n.T(i18n.CmdDescEnv)). | ||
HelpFlag(i18n.T(i18n.CmdHelpEnv)). | ||
GuestRunFunc(func(ctx context.Context, cmdData *cmdBuilder.GuestCmdData) error { | ||
|
||
fmt.Println(styles.CobraSectionColor().SetString("Global Env Variables:").String() + ` | ||
` + styles.CobraItemNameColor().SetString(constants.CliLogFilePathEnvVar).String() + ` ` + i18n.T(i18n.CliLogFilePathEnvVar) + ` | ||
` + styles.CobraItemNameColor().SetString(constants.CliDataFilePathEnvVar).String() + ` ` + i18n.T(i18n.CliDataFilePathEnvVar) + ` | ||
` + styles.CobraItemNameColor().SetString(constants.CliTerminalMode).String() + ` ` + i18n.T(i18n.CliTerminalModeEnvVar)) | ||
|
||
fmt.Println(styles.CobraSectionColor().SetString(` | ||
Curently used variables:`).String()) | ||
|
||
body := &uxBlock.TableBody{} | ||
guestInfoPart(body) | ||
cmdData.UxBlocks.Table(body) | ||
|
||
return nil | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/zeropsio/zcli/src/cmdBuilder" | ||
"github.com/zeropsio/zcli/src/cliStorage" | ||
"github.com/zeropsio/zcli/src/i18n" | ||
"github.com/zeropsio/zcli/src/uxBlock/styles" | ||
) | ||
|
||
var logout string | ||
|
||
func logoutCmd() *cmdBuilder.Cmd { | ||
return cmdBuilder.NewCmd(). | ||
Use("logout"). | ||
Short(i18n.T(i18n.CmdDescLogout)). | ||
HelpFlag(i18n.T(i18n.CmdHelpLogout)). | ||
LoggedUserRunFunc(func(ctx context.Context, cmdData *cmdBuilder.LoggedUserCmdData) error { | ||
|
||
uxBlocks := cmdData.UxBlocks | ||
|
||
_, err := cmdData.RestApiClient.PostAuthLogout(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = cmdData.CliStorage.Update(func(data cliStorage.Data) cliStorage.Data { | ||
return cliStorage.Data{} | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
uxBlocks.PrintInfo(styles.InfoLine(i18n.T(i18n.LogoutVpnDisconnecting))) | ||
disconnectVpn(ctx, cmdData.UxBlocks) // TODO: ask - there is no need for any declaration - i can just call this function from anywhere? | ||
uxBlocks.PrintInfo(styles.SuccessLine(i18n.T(i18n.LogoutSuccess))) | ||
|
||
return nil | ||
|
||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/zeropsio/zcli/src/cmdBuilder" | ||
"github.com/zeropsio/zcli/src/i18n" | ||
) | ||
|
||
var support string | ||
|
||
func supportCmd() *cmdBuilder.Cmd { | ||
return cmdBuilder.NewCmd(). | ||
Use("support"). | ||
Short(i18n.T(i18n.CmdDescSupport)). | ||
HelpFlag(i18n.T(i18n.CmdHelpSupport)). | ||
GuestRunFunc(func(ctx context.Context, cmdData *cmdBuilder.GuestCmdData) error { | ||
|
||
|
||
fmt.Println("You can contact Zerops support via:") | ||
fmt.Println("- E-mail: [email protected]") | ||
fmt.Println("- Discord: https://discord.com/invite/WDvCZ54") | ||
fmt.Println(` | ||
Additionally, you can explore our documentation | ||
at https://docs.zerops.io/references/cli for further details. | ||
`) | ||
return nil | ||
|
||
return nil | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.