Skip to content

Commit

Permalink
Remove wrapper suffix from argument groups
Browse files Browse the repository at this point in the history
Unclear why this was done and good to keep stability
unless there's a reason.
  • Loading branch information
GjjvdBurg committed Apr 9, 2023
1 parent 6691f8a commit 8f918ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion wilderness/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from typing import TextIO

from wilderness.argparse_wrappers import ArgumentParser
from wilderness.argparse_wrappers import MutuallyExclusiveGroupWrapper
from wilderness.command import Command
from wilderness.documentable import DocumentableMixin
from wilderness.formatter import HelpFormatter
Expand Down
4 changes: 2 additions & 2 deletions wilderness/argparse_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def exit(self, status: Optional[int] = 0, message: Optional[str] = None):
sys.exit(status)


class ArgumentGroupWrapper:
class ArgumentGroup:
def __init__(self, group: argparse._ArgumentGroup):
self._group = group
self._command: Optional[wilderness.command.Command] = None
Expand All @@ -55,7 +55,7 @@ def add_argument(self, *args, **kwargs):
return action


class MutuallyExclusiveGroupWrapper:
class MutuallyExclusiveGroup:
def __init__(self, meg: argparse._MutuallyExclusiveGroup):
self._meg = meg
self._command: Optional[wilderness.command.Command] = None
Expand Down
12 changes: 6 additions & 6 deletions wilderness/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from typing import Dict
from typing import Optional

from wilderness.argparse_wrappers import ArgumentGroupWrapper
from wilderness.argparse_wrappers import MutuallyExclusiveGroupWrapper
from wilderness.argparse_wrappers import ArgumentGroup
from wilderness.argparse_wrappers import MutuallyExclusiveGroup
from wilderness.documentable import DocumentableMixin
from wilderness.manpages import ManPage

Expand Down Expand Up @@ -71,19 +71,19 @@ def add_argument(self, *args, **kwargs):
self._arg_help[action.dest] = description
return action

def add_argument_group(self, *args, **kwargs) -> ArgumentGroupWrapper:
def add_argument_group(self, *args, **kwargs) -> ArgumentGroup:
assert self._parser is not None
_group = self._parser.add_argument_group(*args, **kwargs)
group = ArgumentGroupWrapper(_group)
group = ArgumentGroup(_group)
group.command = self
return group

def add_mutually_exclusive_group(
self, *args, **kwargs
) -> MutuallyExclusiveGroupWrapper:
) -> MutuallyExclusiveGroup:
assert self._parser is not None
_meg = self._parser.add_mutually_exclusive_group(*args, **kwargs)
meg = MutuallyExclusiveGroupWrapper(_meg)
meg = MutuallyExclusiveGroup(_meg)
meg.command = self
return meg

Expand Down

0 comments on commit 8f918ba

Please sign in to comment.