Skip to content

Commit

Permalink
Merge pull request #49 from MolarVerse/feature/combine_cli
Browse files Browse the repository at this point in the history
Feature/combine cli
  • Loading branch information
97gamjak authored May 10, 2024
2 parents 43c013a + d041b18 commit 45cf0f2
Show file tree
Hide file tree
Showing 16 changed files with 889 additions and 486 deletions.
26 changes: 5 additions & 21 deletions .docstr.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
paths:
- PQAnalysis
#badge: docs
#exclude: .*/test # regex
exclude: ./tests # regex
verbose: 2 # int (0-3)
skip_magic: True
skip_magic: False
skip_file_doc: True
skip_init: True
skip_init: False
skip_class_def: False
skip_private: True
skip_private: False
follow_links: True
#ignore_names_file: .*/test # regex
#fail_under: 90
percentage_only: False
#ignore_patterns: # Dict with key/value pairs of file-pattern/node-pattern
# .*: method_to_ignore_in_all_files
# FileWhereWeWantToIgnoreAllSpecialMethods: "__.+__"
# SomeFile:
# - method_to_ignore1
# - method_to_ignore2
# - method_to_ignore3
# a_very_important_view_file:
# - "^get$"
# - "^set$"
# - "^post$"
# detect_.*:
# - "get_val.*"
percentage_only: False
102 changes: 0 additions & 102 deletions .github/workflows/docstr.yml

This file was deleted.

7 changes: 5 additions & 2 deletions PQAnalysis/cli/_argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@


from beartype.typing import Sequence
from rich_argparse import ArgumentDefaultsRichHelpFormatter

import PQAnalysis.config as config # pylint: disable=consider-using-from-import # here needed to set the config attributes

from PQAnalysis.utils.common import __header__
from PQAnalysis.traj import MDEngineFormat
from PQAnalysis.io.formats import FileWritingMode
from PQAnalysis._version import __version__
Expand Down Expand Up @@ -46,7 +49,7 @@ def __init__(self, *args, **kwargs):
"""

super().__init__(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
formatter_class=ArgumentDefaultsRichHelpFormatter,
*args,
**kwargs
)
Expand All @@ -55,7 +58,7 @@ def __init__(self, *args, **kwargs):
if 'prog' not in kwargs:
kwargs['prog'] = self.prog.split(".")[0]
super().__init__(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
formatter_class=ArgumentDefaultsRichHelpFormatter,
*args,
**kwargs
)
Expand Down
42 changes: 42 additions & 0 deletions PQAnalysis/cli/_cli_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
This module contains the abstract base class for all the CLI classes.
"""

from abc import ABCMeta, abstractmethod


class CLIBase(metaclass=ABCMeta):
"""
Abstract base class for all the CLI classes.
"""

@classmethod
@abstractmethod
def program_name(cls) -> str:
"""
Return the name of the program.
Returns
-------
str
The name of the program.
"""

@classmethod
@abstractmethod
def add_arguments(cls, parser):
"""
Add the arguments to the parser.
Parameters
----------
parser : _type_
_description_
"""

@classmethod
@abstractmethod
def run(cls, args):
"""
Run the CLI.
"""
Loading

0 comments on commit 45cf0f2

Please sign in to comment.