Skip to content

feat: Prepare For Multi-Command CLI Interface #121

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

Merged
merged 7 commits into from
Apr 15, 2025

Conversation

hf-krechan
Copy link
Contributor

@hf-krechan hf-krechan commented Apr 15, 2025

This PR prepares the fundamend cli tool for further commands.

The current xml2json command is now

fundamend xml2json --xml-path /path/to/my/xml/files

@hf-krechan hf-krechan requested review from hf-kklein and Copilot April 15, 2025 20:24
@hf-krechan hf-krechan marked this pull request as ready for review April 15, 2025 20:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prepares the CLI tool for additional commands by introducing a subcommand structure and updating tests accordingly.

  • Modified the tests to invoke the new "xml2json" subcommand.
  • Added a dedicated module for the xml2json command and integrated it via the commands package.
  • Refactored the CLI entrypoint to support a multi-command interface.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
unittests/test_cli.py Updated test invocations to use the "xml2json" subcommand.
src/fundamend/commands/xml2json.py Added the xml2json command implementation for converting XML to JSON.
src/fundamend/commands/init.py Created a central commands module that registers the xml2json command.
src/fundamend/cli.py Refactored the CLI entrypoint to delegate to the new commands module.

Comment on lines +38 to +40
print(f"Successfully converted {xml_file_path} file to JSON {json_file_path}")
return json_file_path

Copy link
Preview

Copilot AI Apr 15, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider replacing print() with typer.echo() for consistent CLI output handling which integrates better with Typer's logging and testing facilities.

Suggested change
print(f"Successfully converted {xml_file_path} file to JSON {json_file_path}")
return json_file_path
typer.echo(f"Successfully converted {xml_file_path} file to JSON {json_file_path}")

Copilot uses AI. Check for mistakes.


app = typer.Typer(name="xml2json", help="Convert XML(s) by BDEW to JSON(s)")
app = typer.Typer(name="fundamend", help="CLI tool to work with XML files by BDEW", no_args_is_help=True)
Copy link
Contributor

@hf-kklein hf-kklein Apr 15, 2025

Choose a reason for hiding this comment

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

Copy link
Contributor

@hf-kklein hf-kklein left a comment

Choose a reason for hiding this comment

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

fein, bist auf die readme.

@hf-kklein hf-kklein changed the title WIP - Prepare For Mulit-Command CLI Interface feat: Prepare For Multi-Command CLI Interface Apr 15, 2025
@hf-krechan
Copy link
Contributor Author

fixed README in 629ae3d

@hf-krechan hf-krechan enabled auto-merge (squash) April 15, 2025 20:33
@hf-krechan hf-krechan disabled auto-merge April 15, 2025 20:44
@hf-krechan hf-krechan merged commit 5ff5894 into main Apr 15, 2025
18 checks passed
@hf-krechan hf-krechan deleted the prepare-multiple-commands branch April 15, 2025 20:44
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.

2 participants