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

refactor: add the main cli entry point struct Command{} and simplify main() #3850

Merged
merged 1 commit into from
May 7, 2024

Conversation

zyy17
Copy link
Collaborator

@zyy17 zyy17 commented May 1, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

The parsing entry of the current command line is a bit messy and I think we need a cleaner and more unified entry.

  • Add the Command{} struct: Unify all the cli options, including subcommand and global options. When we load the cli option, use Command::parse();

  • Make the main() cleaner by using the following sub-functions:

    • Add setup_human_panic();
    • Add start() to load the options and start the service;
  • Rename CliOptions to GlobalOptions;

Reference: uv has a clean entry point.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

@zyy17 zyy17 requested a review from a team as a code owner May 1, 2024 04:15
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label May 1, 2024
@zyy17 zyy17 changed the title refactor: add the main cli entrypoint struct Command{} to simplify main() refactor: add the main cli entry point struct Command{} and simplify main() May 1, 2024
Copy link

codecov bot commented May 1, 2024

Codecov Report

Attention: Patch coverage is 52.50000% with 38 lines in your changes are missing coverage. Please review.

Project coverage is 85.34%. Comparing base (1b58622) to head (65a72c4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3850      +/-   ##
==========================================
- Coverage   85.61%   85.34%   -0.28%     
==========================================
  Files         952      952              
  Lines      163232   163204      -28     
==========================================
- Hits       139753   139281     -472     
- Misses      23479    23923     +444     

@tisonkun tisonkun enabled auto-merge May 1, 2024 04:33
@tisonkun tisonkun disabled auto-merge May 1, 2024 04:33
@zyy17 zyy17 force-pushed the refactor/cli-options branch 3 times, most recently from d609920 to fe2a858 Compare May 1, 2024 09:30
Copy link
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Good refactor! Thank you.

@zyy17 zyy17 force-pushed the refactor/cli-options branch 2 times, most recently from 78b9f5e to bc600a5 Compare May 7, 2024 08:28
@MichaelScofield MichaelScofield added this pull request to the merge queue May 7, 2024
Merged via the queue into GreptimeTeam:main with commit a68072c May 7, 2024
22 checks passed
@zyy17 zyy17 deleted the refactor/cli-options branch July 2, 2024 11:11
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants