Skip to content

Refactor CLI setup#2503

Open
achilleas-k wants to merge 5 commits into
osbuild:mainfrom
achilleas-k:refactor-cli-setup
Open

Refactor CLI setup#2503
achilleas-k wants to merge 5 commits into
osbuild:mainfrom
achilleas-k:refactor-cli-setup

Conversation

@achilleas-k

@achilleas-k achilleas-k commented Jul 9, 2026

Copy link
Copy Markdown
Member

Create separate functions for each subcommand and a top-level one for creating the root command for both image-builder and bootc-image-builder. The setupRootCmd() function sets up the root command and calls the setupX() function for each of its subcommands.

This is a very simple code-shuffling commit. It's meant to make navigating and reading the CLI creation easier by localising the creation and configuration of each subcommand, making it much clearer which flags apply where, and when things are shared by appearing one level higher in the callstack.


I started this while exploring the code path duplication between image-builder and bootc-image-builder. I wanted to get this merged into main before I move on to more substantial refactoring work.

@achilleas-k achilleas-k force-pushed the refactor-cli-setup branch from bb2165e to 9358371 Compare July 9, 2026 16:30
Create separate functions for each subcommand and a top-level one for
creating the root command.  The setupRootCmd() function sets up the root
command and calls the setupX() function for each of its subcommands.

This is a very simple code-shuffling commit.  It's meant to make
navigating the CLI creation easier by localising the creation and
configuration of each subcommand.
Create separate functions for each subcommand and a top-level one for
creating the root command (previously, this was bibBuildCobraCmdline,
now renamed to match the image-builder root command setup from the
previous commit).  The setupRootCmd() function sets up the root command
and calls the setupX() function for each of its subcommands.

This is a very simple code-shuffling commit.  It's meant to make
navigating the CLI creation easier by localising the creation and
configuration of each subcommand.
Subcommands don't need to support printing the command version.
Update the long description of the bootc-image-builder root command.
Also remove the descriptions from the build command.  I don't think
they're necessary or very useful.
Rephrase a couple of error messages to remove typos and make the failure
reason clearer.
@achilleas-k achilleas-k marked this pull request as ready for review July 10, 2026 07:13
@achilleas-k achilleas-k requested a review from a team as a code owner July 10, 2026 07:13
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