SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

`spacetime --root-dir` does not work

Open bfops opened this issue 8 months ago • 3 comments

Running spacetime with a custom --root-dir gives a cryptic error:

$ spacetime --root-dir ~/.local/bin
Error: a value is required for '--root-dir <root_dir>' but none was supplied

It does work if explicitly passed with =:

spacetime --root-dir=~/.local/bin

bfops avatar Apr 18 '25 18:04 bfops

tenari@dzs-MacBook-Pro SpacetimeDB % cargo run --bin spacetimedb-update -- --root-dir ~/
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/spacetimedb-update --root-dir /Users/tenari/`
error: 'spacetime' requires a subcommand but one was not provided
  [subcommands: version, cli, self-install, help]

Usage: spacetime [OPTIONS] <COMMAND>

For more information, try '--help'.
tenari@dzs-MacBook-Pro SpacetimeDB % cargo run -p spacetimedb-update -- self-install --root-dir ~/
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/spacetimedb-update self-install --root-dir /Users/tenari/`
The SpacetimeDB command line tool will now be installed into /Users/tenari/
Would you like to continue? no
Exiting.

I think this is fixed in master

Tenari avatar Apr 28 '25 21:04 Tenari

tenari@dzs-MacBook-Pro SpacetimeDB % cargo run --bin spacetimedb-update -- --root-dir ~/
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.20s
     Running `target/debug/spacetimedb-update --root-dir /Users/tenari/`
error: 'spacetime' requires a subcommand but one was not provided
  [subcommands: version, cli, self-install, help]

Usage: spacetime [OPTIONS] <COMMAND>

For more information, try '--help'.
tenari@dzs-MacBook-Pro SpacetimeDB % cargo run -p spacetimedb-update -- self-install --root-dir ~/
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/spacetimedb-update self-install --root-dir /Users/tenari/`
The SpacetimeDB command line tool will now be installed into /Users/tenari/
Would you like to continue? no
Exiting.

I think this is fixed in master

Unfortunately not. spacetimedb-update behaves differently if invoked from a binary called spacetime:

$ cargo build -p spacetimedb-update
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.33s

$ target/debug/spacetimedb-update --root-dir ~
error: 'spacetime' requires a subcommand but one was not provided
  [subcommands: version, cli, self-install, help]

Usage: spacetime [OPTIONS] <COMMAND>

For more information, try '--help'.

$ cp target/debug/spacetimedb-update spacetime

$ ./spacetime --root-dir ~
Error: a value is required for '--root-dir <root_dir>' but none was supplied

bfops avatar Apr 28 '25 22:04 bfops

This looks like it's due to the fact that we're parsing args "manually" in crates/update/src/proxy.rs (specifically, in PartialCliArgs::parse).

bfops avatar Apr 28 '25 23:04 bfops