add well-known bucket functionality (only extras so far)

This commit is contained in:
Luke Sampson
2013-08-07 15:03:30 +10:00
parent 69ae330eea
commit 2281ba0d33
3 changed files with 14 additions and 1 deletions

3
buckets.json Normal file
View File

@@ -0,0 +1,3 @@
{
"extras": "https://github.com/lukesampson/scoop-extras.git"
}

View File

@@ -4,6 +4,13 @@ function bucketdir($name) {
"$bucketsdir\$name"
}
function known_bucket_repo($name) {
$dir = versiondir 'scoop' 'current'
$json = "$dir\buckets.json"
$buckets = gc $json -raw | convertfrom-json -ea stop
$buckets.$name
}
<#
# convert an object to a hashtable
function hashtable($obj) {

View File

@@ -25,7 +25,10 @@ $usage_rm = "usage: scoop bucket rm <name>"
function add_bucket($name, $repo) {
if(!$name) { "<name> missing"; $usage_add; exit 1 }
if(!$repo) { "<repo> missing"; $usage_add; exit 1 }
if(!$repo) {
$repo = known_bucket_repo $name
if(!$repo) { "unknown bucket '$name': try specifying <repo>"; $usage_add; exit 1 }
}
$git = try { gcm 'git' -ea stop } catch { $null }
if(!$git) {