Xu Xiaodong avatar Xu Xiaodong committed 7503edd

add repository type support

Comments (0)

Files changed (1)

 # author:    Xu Xiaodong <xxdlhy@gmail.com>
 # license:   GPL
 # created:   2011 Apr 13
-# modified:  2011 Aug 15
+# modified:  2011 Nov 06
 #
 
 use strict;
 use MIME::Base64;
 use Getopt::Long;
 
-my ( $name, $desc, $is_private ) = ( '', '', 0 );
+my ( $name, $desc, $scm, $is_private ) = ( '', '', '', 0 );
 
 GetOptions(
   'n|name=s' => \$name,
   'd|desc=s' => \$desc,
+  's|scm=s'  => \$scm,
   'p|priv'   => \$is_private,
 );
 
-if ($name) {
-  create( $name, $desc, $is_private );
+if ($name and $scm) {
+  create( $name, $desc, $scm, $is_private );
   init($name);
 }
 else {
   die <<"USAGE";
-Usage: $0 -n <name> [-d <desc>] [-p]
+Usage: $0 -n <name> [-d <desc>] -s <scm> [-p]
 
     -n, --name name         Repository name
     -d, --desc description  Project description
+    -s, --scm  scm          Repository type
     -p, --priv private      Set repository as private
 USAGE
 }
 }
 
 sub create {
-  my ( $name, $desc, $is_private ) = @_;
+  my ( $name, $desc, $scm, $is_private ) = @_;
   my %param;
 
   $param{name}        = $name       if $name;
   $param{description} = $desc       if $desc;
+  $param{scm}         = $scm        if $scm;
   $param{is_private}  = $is_private if $is_private;
 
   my $url = 'https://api.bitbucket.org/1.0/repositories/';
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.