Skip to content

Commit

Permalink
chore: Remove closure factory
Browse files Browse the repository at this point in the history
This is not needed to do. Just call the function directly.
  • Loading branch information
rumpelsepp committed Dec 18, 2024
1 parent b6f57ee commit a41323e
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/gallia/cli/gallia.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,18 @@ def parse_and_run(

parser = create_parser(commands)

def make_f(c: Callable[[], None]) -> Callable[[Any], None]:
def f(_: Any) -> None:
c()

return f

if top_level_options is not None:
for name, (func, help_) in top_level_options.items():

class Action(argparse.Action):
f = make_f(func)

def __call__(
self,
parser: argparse.ArgumentParser,
namespace: argparse.Namespace,
values: str | Sequence[Any] | None,
option_string: str | None = None,
) -> None:
self.f()
func()
sys.exit(exitcodes.OK)

parser.add_argument(
Expand Down

0 comments on commit a41323e

Please sign in to comment.