@@ -11,24 +11,32 @@ import (
1111)
1212
1313var (
14- signupGit bool
15- signupOrg string
14+ signupGit bool
15+ signupOrg string
16+ signupEmail string
1617)
1718
1819// signupWithGit authenticates using the Shell Auth flow with git email + SSH key.
1920func signupWithGit () error {
20- // Step 1: Get git email
21- fmt .Print ("Looking up git email... " )
22- email , err := auth .GetGitEmail ()
23- if err != nil {
24- fmt .Println ("✗" )
25- return err
21+ // Step 1: Get email
22+ var email string
23+ if signupEmail != "" {
24+ email = signupEmail
25+ fmt .Printf ("Using email: %s\n " , email )
26+ } else {
27+ fmt .Print ("Looking up git email... " )
28+ var err error
29+ email , err = auth .GetGitEmail ()
30+ if err != nil {
31+ fmt .Println ("✗" )
32+ return err
33+ }
34+ fmt .Println (email )
2635 }
27- fmt .Println (email )
2836
2937 // Step 2: Find SSH public key
3038 fmt .Print ("Looking up SSH public key... " )
31- sshPubKey , err := auth .FindSSHPublicKey ()
39+ sshPubKey , sshKeyPath , err := auth .FindSSHPublicKey ()
3240 if err != nil {
3341 fmt .Println ("✗" )
3442 return err
@@ -131,8 +139,15 @@ func signupWithGit() error {
131139 return err
132140 }
133141
134- if err := auth .SaveAPIKey (keyResp .APIKey ); err != nil {
135- return fmt .Errorf ("error saving API key: %w" , err )
142+ config , err := auth .LoadConfig ()
143+ if err != nil {
144+ return fmt .Errorf ("error loading config: %w" , err )
145+ }
146+ config .APIKey = keyResp .APIKey
147+ config .Email = email
148+ config .SSHKeyPath = sshKeyPath
149+ if err := auth .SaveConfig (config ); err != nil {
150+ return fmt .Errorf ("error saving config: %w" , err )
136151 }
137152
138153 fmt .Printf ("\n ✓ Successfully authenticated with Vers (org: %s)\n " , keyResp .OrgName )
@@ -142,14 +157,15 @@ func signupWithGit() error {
142157var signupCmd = & cobra.Command {
143158 Use : "signup" ,
144159 Short : "Create a Vers account and authenticate" ,
145- Long : `Sign up for the Vers platform using your git email and SSH key.
160+ Long : `Sign up for the Vers platform using your email and SSH key.
146161
147162By default, signup uses your git email and SSH public key to create
148163an account. A verification email is sent — click the link and you're in.
149164
150- vers signup Sign up with git email + SSH key (default)
151- vers signup --org myorg Pick org non-interactively (for scripts/agents)
152- vers signup --git=false Prompt for an API key instead
165+ vers signup Sign up with git email + SSH key (default)
166+ vers signup --email you@example.com Use a specific email instead of git config
167+ vers signup --org myorg Pick org non-interactively (for scripts/agents)
168+ vers signup --git=false Prompt for an API key instead
153169
154170If you already have an account, this will log you in.` ,
155171 RunE : func (cmd * cobra.Command , args []string ) error {
@@ -183,4 +199,5 @@ func init() {
183199 rootCmd .AddCommand (signupCmd )
184200 signupCmd .Flags ().BoolVar (& signupGit , "git" , true , "Authenticate using your git email and SSH key (default: true)" )
185201 signupCmd .Flags ().StringVar (& signupOrg , "org" , "" , "Organization name (skips interactive selection)" )
202+ signupCmd .Flags ().StringVar (& signupEmail , "email" , "" , "Email address (overrides git config user.email)" )
186203}
0 commit comments