Let orbit init run without a registry argument
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
64fd782b0d
commit
32714325a7
1 file changed
+13
-4
+13
-4
@@ -5,7 +5,7 @@ let usage : String =
|
|||||||
#|orbit - packages as OCI artifacts (via oras)
|
#|orbit - packages as OCI artifacts (via oras)
|
||||||
#|
|
#|
|
||||||
#|usage:
|
#|usage:
|
||||||
#| orbit init <registry> [--plain-http] save a different default registry
|
#| orbit init [registry] [--plain-http] set up; optionally save a registry
|
||||||
#| orbit publish <dir> [--no-latest] push <dir>/orbit.json + <dir>/files/
|
#| orbit publish <dir> [--no-latest] push <dir>/orbit.json + <dir>/files/
|
||||||
#| orbit install <name>[@constraint]... install with dependencies
|
#| orbit install <name>[@constraint]... install with dependencies
|
||||||
#| orbit remove <name>... [--force] remove, then drop unused dependencies
|
#| orbit remove <name>... [--force] remove, then drop unused dependencies
|
||||||
@@ -24,7 +24,12 @@ let usage : String =
|
|||||||
#|authentication: run `oras login <registry-host>` once.
|
#|authentication: run `oras login <registry-host>` once.
|
||||||
|
|
||||||
///|
|
///|
|
||||||
|
/// With no registry, only create the directories: any saved config is left
|
||||||
|
/// alone and the built-in default is not written to disk.
|
||||||
fn cmd_init(registry : String, plain_http : Bool) -> Unit raise OrbitError {
|
fn cmd_init(registry : String, plain_http : Bool) -> Unit raise OrbitError {
|
||||||
|
if registry == "" && plain_http {
|
||||||
|
raise OrbitError("usage: orbit init <registry> --plain-http")
|
||||||
|
}
|
||||||
let root = orbit_root()
|
let root = orbit_root()
|
||||||
sh_ok(
|
sh_ok(
|
||||||
"mkdir -p " +
|
"mkdir -p " +
|
||||||
@@ -34,12 +39,14 @@ fn cmd_init(registry : String, plain_http : Bool) -> Unit raise OrbitError {
|
|||||||
" " +
|
" " +
|
||||||
sq(root + "/tmp"),
|
sq(root + "/tmp"),
|
||||||
)
|
)
|
||||||
|
if registry != "" {
|
||||||
write_text_atomic(
|
write_text_atomic(
|
||||||
root + "/config.json",
|
root + "/config.json",
|
||||||
config_to_text(Config::{ registry, plain_http, }),
|
config_to_text(Config::{ registry, plain_http, }),
|
||||||
)
|
)
|
||||||
|
}
|
||||||
println("orbit root: \{root}")
|
println("orbit root: \{root}")
|
||||||
println("registry: \{registry}")
|
println("registry: \{load_ctx().cfg.registry}")
|
||||||
println("add to your shell profile:")
|
println("add to your shell profile:")
|
||||||
println(" export PATH=\"\{root}/bin:$PATH\"")
|
println(" export PATH=\"\{root}/bin:$PATH\"")
|
||||||
}
|
}
|
||||||
@@ -70,8 +77,10 @@ fn dispatch(args : Array[String]) -> Unit raise OrbitError {
|
|||||||
match cmd {
|
match cmd {
|
||||||
"help" | "-h" | "--help" => println(usage)
|
"help" | "-h" | "--help" => println(usage)
|
||||||
"init" => {
|
"init" => {
|
||||||
need(pos, 1, "init <registry> [--plain-http]")
|
cmd_init(
|
||||||
cmd_init(pos[0], flags.contains("--plain-http"))
|
if pos.length() > 0 { pos[0] } else { "" },
|
||||||
|
flags.contains("--plain-http"),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
"env" => println("export PATH=\"\{orbit_root()}/bin:$PATH\"")
|
"env" => println("export PATH=\"\{orbit_root()}/bin:$PATH\"")
|
||||||
"publish" => {
|
"publish" => {
|
||||||
|
|||||||
Reference in new issue
Block a user