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

otk: don't use click #102

Merged
merged 8 commits into from
May 30, 2024
Merged

otk: don't use click #102

merged 8 commits into from
May 30, 2024

Conversation

supakeen
Copy link
Member

Start removing click from the main otk command.

@supakeen supakeen linked an issue May 29, 2024 that may be closed by this pull request
@supakeen supakeen force-pushed the use-argparse branch 5 times, most recently from 5fe3419 to 2a6fcd1 Compare May 30, 2024 10:00
@supakeen supakeen marked this pull request as ready for review May 30, 2024 10:00
@supakeen
Copy link
Member Author

This PR also drops the -w/--warn option as we're still figuring out how to deal with that in #101.

example.yaml Show resolved Hide resolved
src/otk/command.py Outdated Show resolved Hide resolved
src/otk/command.py Outdated Show resolved Hide resolved
src/otk/command.py Outdated Show resolved Hide resolved
Don't use click as it is not available in RHEL, instead use the built-in
argparse. This also adds minor tests for the command line.

Signed-off-by: Simon de Vlieger <[email protected]>
These examples accidentally got into the repository.

Signed-off-by: Simon de Vlieger <[email protected]>
Use the argparse required subcommands even if the help is a bit
suboptimal it gives us clearer code.

Signed-off-by: Simon de Vlieger <[email protected]>
We need this available earlier otherwise the next check fails.

Signed-off-by: Simon de Vlieger <[email protected]>
Doing this makes the output show the place where the subcommand goes.

Signed-off-by: Simon de Vlieger <[email protected]>
This can live in the constructor.

Signed-off-by: Simon de Vlieger <[email protected]>
Setting the help makes sure the command actually show up in the help
text.

Signed-off-by: Simon de Vlieger <[email protected]>
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM except for a tiny comment and a type annotation.

Much cleaner now I think :)

log.info("Compiling the input file %r to %r", input, output or "STDOUT")
if not src.exists():
log.fatal("INPUT path %r does not exist", str(src))
return 1
Copy link
Member

Choose a reason for hiding this comment

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

Function's type annotation should say it returns an int now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a commit to fix the signature.

src/otk/command.py Outdated Show resolved Hide resolved
Signed-off-by: Simon de Vlieger <[email protected]>
@achilleas-k achilleas-k added this pull request to the merge queue May 30, 2024
Merged via the queue into osbuild:main with commit 4372d98 May 30, 2024
1 check passed
@supakeen supakeen linked an issue May 30, 2024 that may be closed by this pull request
mvo5 added a commit to mvo5/osbuild-otk that referenced this pull request Jun 21, 2024
Click was removed in osbuild#102
so it can be safely removed from the pyproject.toml.
github-merge-queue bot pushed a commit that referenced this pull request Jun 21, 2024
Click was removed in #102
so it can be safely removed from the pyproject.toml.
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.

Specifying OUTPUT for compile has no effect Drop click dependency for argparse
2 participants