Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI - Warn when using an unstable command #2227

Merged
merged 5 commits into from
Feb 8, 2025
Merged

Conversation

bfops
Copy link
Collaborator

@bfops bfops commented Feb 8, 2025

Description of Changes

Addresses #1820.

  • Print a warning when using unstable subcommands or args
  • Unstable commands also have unstable markers in their --help text

Note: I only added this text to the CLI commands list. I did not add it to other binaries, especially spacetimedb-update.

API and ABI breaking changes

Not API/ABI breaking.

Expected complexity level and risk

1

Testing

  • Helptext contains the warning
$ cargo run -pspacetimedb-cli -- init --help
   Compiling spacetimedb-cli v1.0.0-rc4 (/home/lead/work/clockwork-localhd/SpacetimeDBPrivate/public/crates/cli)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 17.35s
     Running `target/debug/spacetimedb-cli init --help`
Initializes a new spacetime project.

WARNING: This command is UNSTABLE and subject to breaking changes.

Usage: spacetimedb-cli init --lang <lang> [project-path]

Arguments:
  [project-path]  The path where we will create the spacetime project [default: .]

Options:
  -l, --lang <lang>  The spacetime module language. [possible values: csharp, rust]
  -h, --help         Print help
  • Using an unstable command shows the warning
$ cargo run -pspacetimedb-cli -- list
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.26s
     Running `target/debug/spacetimedb-cli list`
WARNING: This command is UNSTABLE and subject to breaking changes.

Associated database identities for c20058f5a5bbcbfd65110416110492e91d5ab64054640deb456bd5fa8a2ab9d5:

 db_identity                                                      
------------------------------------------------------------------
 c200bff0b7ec3b9af7247886265bc8a831b3f3067b9f32263fcf954d03e98088 
 c200b0e6eda45da7e3c702b2c5e1412517842c34cf06200ed8733551fd624ea0 
 c20001583eb7da147b40500c64d590089c1bb5e112be31eba202c8c50d63baf4 
  • Using a subcommand of an unstable command also shows the warning
$ cargo run -pspacetimedb-cli -- server list
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.25s
     Running `target/debug/spacetimedb-cli server list`
WARNING: This command is UNSTABLE and subject to breaking changes.

 DEFAULT  HOSTNAME                           PROTOCOL  NICKNAME              
          foo.com                            https     foo-test-bad-server   
     ***  127.0.0.1:3000                     http      local                 
          testnet.spacetimedb.com            https     testnet               
          foo2.com                           https     foo-test-bad-server-2 
          maincloud.staging.spacetimedb.com  https     maincloud-staging     
          testnet.staging.spacetimedb.com    https     staging   

@bfops bfops marked this pull request as ready for review February 8, 2025 00:05
@bfops bfops requested a review from cloutiertyler as a code owner February 8, 2025 00:05
@cloutiertyler
Copy link
Contributor

This is relevant to #1072

I'm going to remove the release-1.0 label from #1072 because we're marking the command as unstable anyway.

Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now. I think eprintln is the way to go.

@bfops bfops added this pull request to the merge queue Feb 8, 2025
Merged via the queue into master with commit 5ddd73e Feb 8, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants