Skip to content
This repository

Added ability to set the repo name on create-from-local #78

Merged
merged 1 commit into from over 2 years ago

3 participants

Chris Schmitz AB12CD34 Dr Nic Williams
Chris Schmitz

Added a repo_name parameter to the create-from-local command that lets you set the name of the new remote repo.

Usage: github create-from-local new-repo-name

Dr Nic Williams drnic merged commit 51521a5 into from November 23, 2011
Dr Nic Williams drnic closed this November 23, 2011
AB12CD34

welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 23, 2011
Chris Schmitz Added a `repo_name` parameter that lets you set the name of the new r…
…emote repo.
5a7c717
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. 11  lib/commands/commands.rb
11  lib/commands/commands.rb
@@ -237,15 +237,20 @@
237 237
 end
238 238
 
239 239
 desc "Create a new GitHub repository from the current local repository"
  240
+usage "github create-from-local [repo_name]"
240 241
 flags :private => 'Create private repository'
241  
-command :'create-from-local' do
  242
+command :'create-from-local' do |repo_name|
242 243
   cwd = sh "pwd"
243  
-  repo = File.basename(cwd)
  244
+  if repo_name.nil?
  245
+    repo = File.basename(cwd)
  246
+  else
  247
+    repo = repo_name
  248
+  end
244 249
   is_repo = !git("status").match(/fatal/)
245 250
   raise "Not a git repository. Use 'gh create' instead" unless is_repo
246 251
   created = sh "curl -F 'repository[name]=#{repo}' -F 'repository[public]=#{options[:private] != true}' -F 'login=#{github_user}' -F 'token=#{github_token}' https://github.com/repositories"
247 252
   if created.out =~ %r{You are being <a href="https://github.com/#{github_user}/([^"]+)"}
248  
-    git "remote add origin git@github.com:#{github_user}/#{$1}.git"
  253
+    git "remote add origin git@github.com:#{github_user}/#{repo}.git"
249 254
     git_exec "push origin master"
250 255
   else
251 256
     puts created # perhaps curl doesn't exist
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.