bin/githubrepo in githubrepo-0.2.0 vs bin/githubrepo in githubrepo-0.2.2
- old
+ new
@@ -2,47 +2,56 @@
require File.expand_path '../lib/githubrepo', File.dirname(__FILE__)
require 'commander/import'
program :name, 'githubrepo'
-program :version, '0.2.0'
+program :version, '0.2.2'
program :description, 'Create GitHub repositories from the command line.
+
OSX: repository URL is automatically copied to clipboard.
Linux: install xclip (sudo apt-get xclip) and URL will auto copy to clipboard.
Windows: run "gem install ffi" and URL will auto copy to clipboard.'
+
program :help, 'Author', 'Elikem Adadevoh <elikem@gmail.com>'
command :create do |c|
c.syntax = 'githubrepo create [options]'
- c.description = 'githubrepo create REPO_NAME'
+ c.description = 'githubrepo create REPO_NAME -d REPO_DESCRIPTION'
- c.example 'usage 1', 'githubrepo create REPO_NAME'
- c.example 'usage 2 -- create is the default action for this gem', 'githubrepo REPO_NAME'
+ c.example 'usage', 'githubrepo create REPO_NAME'
+ c.example 'usage', 'githubrepo REPO_NAME'
+ c.example 'description', 'githubrepo create REPO_NAME -d "short description"'
- #the ability to add a description will come later
- #c.example 'description', 'githubrepo create REPO_NAME -d "short description"'
- #c.option '--description STRING', String, 'A short description of the repository'
+ c.option '--description STRING', String, 'A short description of the repository'
c.action do |args, options|
repository = args.shift
+ description = options.description
+
+ # check for repository argument
if repository.nil?
+ puts 'repository'
puts 'invalid option -- githubrepo create REPO_NAME'
exit
end
+ # get and check name
username = ask "'Username for 'https://github.com': "
if username.length == 0
puts 'invalid option -- please enter a username'
exit
end
+ # set password
password = ask('Password: ') { |char| char.echo = false }
- cli({ :repository => repository, :username => username, :password => password })
+ # package attributes for http api payload
+ cli({ :repository => repository, :description => description, :username => username, :password => password })
end
end
+# set default action for gem
default_command :create
def cli(attributes)
Githubrepo.create(attributes)
end