mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Add user main command and add switch as sub command
This commit is contained in:
@@ -354,7 +354,7 @@ func getFreshUserCredentials(email string, password string) (*api.GetLoginOneV2R
|
||||
|
||||
func addNewUserPrompt() (bool, error) {
|
||||
prompt := promptui.Select{
|
||||
Label: "Infisical detects previous logged in users. Would you like to add a new user? Select[Yes/No]",
|
||||
Label: "A user is already logged in. Would you like to add a new user? Select[Yes/No]",
|
||||
Items: []string{"No", "Yes"},
|
||||
}
|
||||
|
||||
@@ -362,6 +362,7 @@ func addNewUserPrompt() (bool, error) {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result == "Yes", err
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,15 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var userCmd = &cobra.Command{
|
||||
Use: "user",
|
||||
Short: "Used manage user credentials",
|
||||
DisableFlagsInUseLine: true,
|
||||
Example: "infisical user",
|
||||
Args: cobra.ExactArgs(0),
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
var switchCmd = &cobra.Command{
|
||||
Use: "switch",
|
||||
Short: "Used to switch between Infisical profiles",
|
||||
@@ -50,7 +59,8 @@ var switchCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(switchCmd)
|
||||
userCmd.AddCommand(switchCmd)
|
||||
rootCmd.AddCommand(userCmd)
|
||||
}
|
||||
|
||||
func getLoggedInUsers() ([]string, error) {
|
||||
Reference in New Issue
Block a user