@@ -35,18 +35,22 @@ Examples:
3535}
3636
3737func init () {
38- CreateCmd .AddCommand (createRepoCmd )
38+ CreateCmd .AddCommand (createRepoCmd )
3939
4040 createRepoCmd .Flags ().StringP ("name" , "n" , "" , "Repository name (default: directory name)" )
4141 createRepoCmd .Flags ().StringP ("description" , "d" , "" , "Repository description" )
4242 createRepoCmd .Flags ().BoolP ("private" , "p" , false , "Make repository private" )
4343 createRepoCmd .Flags ().StringP ("org" , "o" , "" , "Create repository under an organization" )
4444 createRepoCmd .Flags ().String ("remote" , "origin" , "Git remote name to use" )
4545 createRepoCmd .Flags ().String ("branch" , "main" , "Default branch name" )
46- createRepoCmd .Flags ().Bool ("no-push" , false , "Do not push to the remote after creation" )
47- createRepoCmd .Flags ().Bool ("dry-run" , false , "Show planned actions without applying changes" )
48- createRepoCmd .Flags ().Bool ("non-interactive" , false , "Disable interactive prompts" )
49- createRepoCmd .Flags ().Bool ("save-config" , false , "Persist answers for future runs in .eos/create-repo.yaml" )
46+ createRepoCmd .Flags ().Bool ("no-push" , false , "Do not push to the remote after creation" )
47+ createRepoCmd .Flags ().Bool ("dry-run" , false , "Show planned actions without applying changes" )
48+ createRepoCmd .Flags ().Bool ("non-interactive" , false , "Disable interactive prompts" )
49+ createRepoCmd .Flags ().Bool ("save-config" , false , "Persist answers for future runs in .eos/create-repo.yaml" )
50+ createRepoCmd .Flags ().String ("auth" , "ssh" , "Preferred auth for git remote: ssh or https" )
51+ createRepoCmd .Flags ().Bool ("auto-fix-ownership" , false , "If run with sudo, chown the repo to the original user" )
52+ createRepoCmd .Flags ().Bool ("ssh-generate-key" , true , "Generate an SSH key if missing when --auth=ssh" )
53+ createRepoCmd .Flags ().Bool ("configure-credential-helper" , true , "Configure git credential.helper for HTTPS when --auth=https" )
5054}
5155
5256func runCreateRepo (rc * eos_io.RuntimeContext , cmd * cobra.Command , args []string ) error {
@@ -164,28 +168,36 @@ func runCreateRepo(rc *eos_io.RuntimeContext, cmd *cobra.Command, args []string)
164168
165169 name , _ := cmd .Flags ().GetString ("name" )
166170 description , _ := cmd .Flags ().GetString ("description" )
167- private , _ := cmd .Flags ().GetBool ("private" )
168- org , _ := cmd .Flags ().GetString ("org" )
169- remote , _ := cmd .Flags ().GetString ("remote" )
170- branch , _ := cmd .Flags ().GetString ("branch" )
171- noPush , _ := cmd .Flags ().GetBool ("no-push" )
172- dryRun , _ := cmd .Flags ().GetBool ("dry-run" )
173- // nonInteractive already parsed above for preflight checks
174- saveConfig , _ := cmd .Flags ().GetBool ("save-config" )
175-
176- opts := & repository.RepoOptions {
177- Path : absPath ,
178- Name : name ,
179- Description : description ,
180- Private : private ,
181- Organization : org ,
182- Remote : remote ,
183- Branch : branch ,
184- DryRun : dryRun ,
185- NoPush : noPush ,
186- NonInteractive : nonInteractive ,
187- SaveConfig : saveConfig ,
188- }
171+ private , _ := cmd .Flags ().GetBool ("private" )
172+ org , _ := cmd .Flags ().GetString ("org" )
173+ remote , _ := cmd .Flags ().GetString ("remote" )
174+ branch , _ := cmd .Flags ().GetString ("branch" )
175+ noPush , _ := cmd .Flags ().GetBool ("no-push" )
176+ dryRun , _ := cmd .Flags ().GetBool ("dry-run" )
177+ // nonInteractive already parsed above for preflight checks
178+ saveConfig , _ := cmd .Flags ().GetBool ("save-config" )
179+ auth , _ := cmd .Flags ().GetString ("auth" )
180+ autoFixOwnership , _ := cmd .Flags ().GetBool ("auto-fix-ownership" )
181+ sshGenKey , _ := cmd .Flags ().GetBool ("ssh-generate-key" )
182+ cfgCredHelper , _ := cmd .Flags ().GetBool ("configure-credential-helper" )
183+
184+ opts := & repository.RepoOptions {
185+ Path : absPath ,
186+ Name : name ,
187+ Description : description ,
188+ Private : private ,
189+ Organization : org ,
190+ Remote : remote ,
191+ Branch : branch ,
192+ DryRun : dryRun ,
193+ NoPush : noPush ,
194+ NonInteractive : nonInteractive ,
195+ SaveConfig : saveConfig ,
196+ Auth : strings .ToLower (strings .TrimSpace (auth )),
197+ AutoFixOwnership : autoFixOwnership ,
198+ SSHGenerateKey : sshGenKey ,
199+ ConfigureCredHelper : cfgCredHelper ,
200+ }
189201
190202 prefsPath := repository .PreferencesPath (absPath )
191203 prefs , err := repository .LoadRepoPreferences (prefsPath )
0 commit comments