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

fix(torii): missing cli version flag #2700

Merged
merged 1 commit into from
Nov 18, 2024
Merged

fix(torii): missing cli version flag #2700

merged 1 commit into from
Nov 18, 2024

Conversation

kariy
Copy link
Member

@kariy kariy commented Nov 18, 2024

resolves #2699

was deleted in #2681

@kariy kariy requested a review from steebchen November 18, 2024 08:14
Copy link

coderabbitai bot commented Nov 18, 2024

Walkthrough

Ohayo, sensei! This pull request introduces modifications to the ToriiArgs struct in the args.rs file, specifically updating the command attributes for the CLI parser by replacing the author attribute with a version attribute. Additionally, the ToriiArgsConfig struct now includes an optional rpc field, allowing for more flexible configuration of the RPC URL. The with_config_file method has also been updated to ensure that the rpc field is set to None if it matches the default RPC URL, enhancing the configuration merging process.

Changes

File Path Change Summary
crates/torii/cli/src/args.rs - Updated ToriiArgs struct: replaced author with version in #[command(...)] macro.
- Added pub rpc: Option<Url> field to ToriiArgsConfig struct.
- Modified with_config_file method to set rpc to None if it matches the default URL.

Possibly related PRs

  • feat(torii): update cli to match katana's #2672: The changes in this PR also involve updates to the CLI, specifically modifying command-line argument structures, which directly relates to the changes made in the ToriiArgs struct in the main PR.

Suggested reviewers

  • Larkooo
  • glihm
  • steebchen

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f6659db and de6af4e.

📒 Files selected for processing (1)
  • crates/torii/cli/src/args.rs (1 hunks)
🔇 Additional comments (2)
crates/torii/cli/src/args.rs (2)

17-17: Ohayo sensei! The version flag has been properly restored! ✨

The addition of the version attribute to the command macro correctly restores the CLI version flag functionality that was previously removed in PR #2681.


17-17: Verify the version flag functionality, sensei! 🔍

Let's ensure the version flag works as expected with the CLI.

✅ Verification successful

Let me try a different approach to verify the version flag implementation.


Version flag implementation looks correct, sensei! ✨

The code shows the version flag is properly configured in the clap derive macro with #[command(name = "torii", author, version, about, long_about = None)]. This is the standard way to enable version flag functionality in clap, which automatically implements both -V and --version flags.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the version flag is properly recognized by the CLI parser

# Test 1: Check if --version flag is recognized in the help output
cargo run --bin torii -- --help | grep -i "version"

# Test 2: Check if -V shorthand is available (clap's default version flag)
cargo run --bin torii -- -V 2>&1 || true

# Test 3: Check if --version longhand is available
cargo run --bin torii -- --version 2>&1 || true

Length of output: 352


Script:

#!/bin/bash
# Let's verify the version flag implementation in the code directly

# Check if version is properly configured in clap derive macro
ast-grep --pattern '#[command(version)]' 

# Look for version-related configuration in the args.rs file
rg -A 2 'version' crates/torii/cli/src/args.rs

# Check if there are any test cases for version flag
rg -l 'test.*version' crates/torii/cli/src/

Length of output: 284


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.35%. Comparing base (f6659db) to head (de6af4e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2700      +/-   ##
==========================================
+ Coverage   56.34%   56.35%   +0.01%     
==========================================
  Files         411      411              
  Lines       52742    52742              
==========================================
+ Hits        29719    29725       +6     
+ Misses      23023    23017       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kariy kariy enabled auto-merge (squash) November 18, 2024 09:58
@kariy kariy merged commit bc50d9e into main Nov 18, 2024
14 checks passed
@kariy kariy deleted the torii/version branch November 18, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] torii v1.0.1 doesn't have --version anymore
1 participant