Skip to content

Commit

Permalink
Don't load configuration for verbs that don't need it
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanDeMeyer authored and behrmann committed Mar 19, 2024
1 parent 53575a1 commit 57ca06d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mkosi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def needs_root(self) -> bool:
def needs_credentials(self) -> bool:
return self in (Verb.summary, Verb.qemu, Verb.boot, Verb.shell)

def needs_config(self) -> bool:
return self not in (Verb.help, Verb.genkey, Verb.documentation)


class ConfigFeature(StrEnum):
auto = enum.auto()
Expand Down Expand Up @@ -3303,6 +3306,9 @@ def finalize_defaults(namespace: argparse.Namespace, defaults: argparse.Namespac
if args.verb == Verb.help:
PagerHelpAction.__call__(None, argparser, namespace) # type: ignore

if not args.verb.needs_config():
return args, ()

include = ()

if args.directory is not None:
Expand Down

0 comments on commit 57ca06d

Please sign in to comment.