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 - Remove newlines from command helptext #2277

Merged
merged 1 commit into from
Feb 18, 2025
Merged

Conversation

bfops
Copy link
Collaborator

@bfops bfops commented Feb 18, 2025

Description of Changes

These were causing issues when we rendered the helptext into markdown in clockworklabs/spacetime-docs#168:

image

They also looked a bit weird when doing spacetime help:

Usage:
spacetimedb-cli [OPTIONS] <COMMAND>

Options:
      --root-dir <root_dir>        The root directory to store all spacetime files in.
      --config-path <config_path>  The path to the cli.toml config file
  -h, --help                       Print help
  -V, --version                    Print version

Commands:
  publish    Create and update a SpacetimeDB database
  delete     Deletes a SpacetimeDB database
  logs       Prints logs from a SpacetimeDB database
  call       Invokes a reducer function in a database.
             
             WARNING: This command is UNSTABLE and subject to breaking changes.
  describe   Describe the structure of a database or entities within it.
             
             WARNING: This command is UNSTABLE and subject to breaking changes.
  energy     Invokes commands related to database budgets.
             
             WARNING: This command is UNSTABLE and subject to breaking changes.
  sql        Runs a SQL query on the database.
             
             WARNING: This command is UNSTABLE and subject to breaking changes.
  rename     Rename a database
  generate   Generate client files for a spacetime module.
  list       Lists the databases attached to an identity.
             
             WARNING: This command is UNSTABLE and subject to breaking changes.
  login      Manage your login to the SpacetimeDB CLI
  logout     
  init       Initializes a new spacetime project.
             
             WARNING: This command is UNSTABLE and subject to breaking changes.
  build      Builds a spacetime module.
  server     Manage the connection to the SpacetimeDB server.
             
             WARNING: This command is UNSTABLE and subject to breaking changes.
  subscribe  Subscribe to SQL queries on the database.
             
             WARNING: This command is UNSTABLE and subject to breaking changes.
  start      Start a local SpacetimeDB instance
  version    Manage installed spacetime versions
  help       Print this message or the help of the given subcommand(s)

API and ABI breaking changes

No breaking changes.

Expected complexity level and risk

1

Testing

  • New toplevel helptext looks reasonable:
Usage:
spacetimedb-cli [OPTIONS] <COMMAND>

Options:
      --root-dir <root_dir>        The root directory to store all spacetime files in.
      --config-path <config_path>  The path to the cli.toml config file
  -h, --help                       Print help
  -V, --version                    Print version

Commands:
  publish    Create and update a SpacetimeDB database
  delete     Deletes a SpacetimeDB database
  logs       Prints logs from a SpacetimeDB database
  call       Invokes a reducer function in a database. WARNING: This command is UNSTABLE and subject to breaking changes.
  describe   Describe the structure of a database or entities within it. WARNING: This command is UNSTABLE and subject to breaking changes.
  energy     Invokes commands related to database budgets. WARNING: This command is UNSTABLE and subject to breaking changes.
  sql        Runs a SQL query on the database. WARNING: This command is UNSTABLE and subject to breaking changes.
  rename     Rename a database
  generate   Generate client files for a spacetime module.
  list       Lists the databases attached to an identity. WARNING: This command is UNSTABLE and subject to breaking changes.
  login      Manage your login to the SpacetimeDB CLI
  logout     
  init       Initializes a new spacetime project. WARNING: This command is UNSTABLE and subject to breaking changes.
  build      Builds a spacetime module.
  server     Manage the connection to the SpacetimeDB server. WARNING: This command is UNSTABLE and subject to breaking changes.
  subscribe  Subscribe to SQL queries on the database. WARNING: This command is UNSTABLE and subject to breaking changes.
  start      Start a local SpacetimeDB instance
  version    Manage installed spacetime versions
  help       Print this message or the help of the given subcommand(s)
  • An arbitrary command's help text seems reasonable too:
Subscribe to SQL queries on the database. WARNING: This command is UNSTABLE and subject to breaking changes.

Usage: spacetimedb-cli subscribe [OPTIONS] <database> <query>...

Arguments:
  <database>  The name or identity of the database you would like to query
  <query>...  The SQL query to execute

Options:
  -n, --num-updates <num-updates>  The number of subscription updates to receive before exiting
  -t, --timeout <timeout>          The timeout, in seconds, after which to disconnect and stop receiving subscription messages. If `-n` is specified, it will stop after whichever
                                                        one comes first.
      --print-initial-update       Print the initial update for the queries.
      --anonymous                  Perform this action with an anonymous identity
  -y, --yes                        Run non-interactively wherever possible. This will answer "yes" to almost all prompts, but will sometimes answer "no" to preserve non-interactivity (e.g. when prompting whether to log in with
                                   spacetimedb.com).
  -s, --server <server>            The nickname, host name or URL of the server hosting the database
  -h, --help                       Print help

@bfops bfops added the release-any To be landed in any release window label Feb 18, 2025
@bfops bfops marked this pull request as ready for review February 18, 2025 23:11
@bfops bfops requested a review from cloutiertyler as a code owner February 18, 2025 23:11
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.

No objection to this.

@bfops bfops added this pull request to the merge queue Feb 18, 2025
Merged via the queue into master with commit 0162ace Feb 18, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants