improved fetch
This commit is contained in:
33
link.ce
33
link.ce
@@ -34,17 +34,18 @@ var _restore = null
|
||||
var _read_toml = null
|
||||
var _add_link = null
|
||||
|
||||
if (length(args) < 1) {
|
||||
log.console("Usage: link <command> [args] or link [package] <target>")
|
||||
log.console("Commands:")
|
||||
log.console(" list List all active links")
|
||||
log.console(" sync Ensure all symlinks are in place")
|
||||
log.console(" delete <package> Remove a link and restore original")
|
||||
log.console(" clear Remove all links")
|
||||
log.console(" <path> Link the package in <path> to that path")
|
||||
log.console(" <package> <target> Link <package> to <target> (path or package)")
|
||||
$stop()
|
||||
}
|
||||
var run = function() {
|
||||
if (length(args) < 1) {
|
||||
log.console("Usage: link <command> [args] or link [package] <target>")
|
||||
log.console("Commands:")
|
||||
log.console(" list List all active links")
|
||||
log.console(" sync Ensure all symlinks are in place")
|
||||
log.console(" delete <package> Remove a link and restore original")
|
||||
log.console(" clear Remove all links")
|
||||
log.console(" <path> Link the package in <path> to that path")
|
||||
log.console(" <package> <target> Link <package> to <target> (path or package)")
|
||||
return
|
||||
}
|
||||
|
||||
cmd = args[0]
|
||||
|
||||
@@ -71,7 +72,7 @@ if (cmd == 'list') {
|
||||
} else if (cmd == 'delete' || cmd == 'rm') {
|
||||
if (length(args) < 2) {
|
||||
log.console("Usage: link delete <package>")
|
||||
$stop()
|
||||
return
|
||||
}
|
||||
|
||||
pkg = args[1]
|
||||
@@ -113,7 +114,7 @@ if (cmd == 'list') {
|
||||
|
||||
if (!arg1) {
|
||||
log.console("Error: target or package required")
|
||||
$stop()
|
||||
return
|
||||
}
|
||||
|
||||
if (arg2) {
|
||||
@@ -136,7 +137,7 @@ if (cmd == 'list') {
|
||||
if (!fd.is_file(toml_path)) {
|
||||
log.console("Error: No cell.toml found at " + target)
|
||||
log.console("For linking to another package, use: link <package> <target>")
|
||||
$stop()
|
||||
return
|
||||
}
|
||||
|
||||
// Read package name from cell.toml
|
||||
@@ -159,7 +160,7 @@ if (cmd == 'list') {
|
||||
if (starts_with(target, '/')) {
|
||||
if (!fd.is_file(target + '/cell.toml')) {
|
||||
log.console("Error: " + target + " is not a valid package (no cell.toml)")
|
||||
$stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,5 +173,7 @@ if (cmd == 'list') {
|
||||
}
|
||||
_add_link()
|
||||
}
|
||||
}
|
||||
run()
|
||||
|
||||
$stop()
|
||||
|
||||
Reference in New Issue
Block a user