mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
new app preview img in docs
This commit is contained in:
-1199
File diff suppressed because it is too large
Load Diff
+9
-6
@@ -3,11 +3,14 @@ from typing import Literal
|
||||
|
||||
|
||||
class BaseArgument(ABC):
|
||||
"""
|
||||
Private. Base class for all arguments
|
||||
"""
|
||||
@abstractmethod
|
||||
def get_string_entity(self):
|
||||
def get_string_entity(self) -> str:
|
||||
"""
|
||||
Returns the string representation of the argument
|
||||
:return:
|
||||
Public. Returns the string representation of the argument
|
||||
:return: the string representation as a str
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -15,7 +18,7 @@ class BaseArgument(ABC):
|
||||
class PositionalArgument(BaseArgument):
|
||||
def __init__(self, name: str):
|
||||
"""
|
||||
Required argument at startup
|
||||
Public. Required argument at startup
|
||||
:param name: name of the argument, must not start with minus (-)
|
||||
"""
|
||||
self.name = name
|
||||
@@ -27,7 +30,7 @@ class PositionalArgument(BaseArgument):
|
||||
class OptionalArgument(BaseArgument):
|
||||
def __init__(self, name: str, prefix: Literal['-', '--', '---'] = '--'):
|
||||
"""
|
||||
Optional argument, must have the value
|
||||
Public. Optional argument, must have the value
|
||||
:param name: name of the argument
|
||||
:param prefix: prefix of the argument
|
||||
"""
|
||||
@@ -41,7 +44,7 @@ class OptionalArgument(BaseArgument):
|
||||
class BooleanArgument(BaseArgument):
|
||||
def __init__(self, name: str, prefix: Literal['-', '--', '---'] = '--'):
|
||||
"""
|
||||
Boolean argument, does not require a value
|
||||
Public. Boolean argument, does not require a value
|
||||
:param name: name of the argument
|
||||
:param prefix: prefix of the argument
|
||||
"""
|
||||
@@ -12,7 +12,7 @@ class ArgParse:
|
||||
description: str = 'Argenta available arguments',
|
||||
epilog: str = 'github.com/koloideal/Argenta | made by kolo') -> None:
|
||||
"""
|
||||
Cmd argument parser and configurator at startup
|
||||
Public. Cmd argument parser and configurator at startup
|
||||
:param name: the name of the ArgParse instance
|
||||
:param description: the description of the ArgParse instance
|
||||
:param epilog: the epilog of the ArgParse instance
|
||||
@@ -25,18 +25,18 @@ class ArgParse:
|
||||
self.entity: ArgumentParser = ArgumentParser(prog=name, description=description, epilog=epilog)
|
||||
self.args: list[PositionalArgument | OptionalArgument | BooleanArgument] | None = processed_args
|
||||
|
||||
def set_args(self, *args: PositionalArgument | OptionalArgument | BooleanArgument):
|
||||
def set_args(self, *args: PositionalArgument | OptionalArgument | BooleanArgument) -> None:
|
||||
"""
|
||||
Sets the arguments to be processed
|
||||
Public. Sets the arguments to be processed
|
||||
:param args: processed arguments
|
||||
:return:
|
||||
:return: None
|
||||
"""
|
||||
self.args.extend(args)
|
||||
|
||||
def register_args(self):
|
||||
def register_args(self) -> None:
|
||||
"""
|
||||
Registers initialized command line arguments
|
||||
:return:
|
||||
Private. Registers initialized command line arguments
|
||||
:return: None
|
||||
"""
|
||||
if not self.args:
|
||||
return
|
||||
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
Reference in New Issue
Block a user