lockss-pybasic 0.1.0.dev5__tar.gz → 0.1.0.dev7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lockss_pybasic-0.1.0.dev5 → lockss_pybasic-0.1.0.dev7}/PKG-INFO +1 -1
- {lockss_pybasic-0.1.0.dev5 → lockss_pybasic-0.1.0.dev7}/pyproject.toml +1 -1
- {lockss_pybasic-0.1.0.dev5 → lockss_pybasic-0.1.0.dev7}/src/lockss/pybasic/__init__.py +1 -1
- {lockss_pybasic-0.1.0.dev5 → lockss_pybasic-0.1.0.dev7}/src/lockss/pybasic/cliutil.py +55 -9
- {lockss_pybasic-0.1.0.dev5 → lockss_pybasic-0.1.0.dev7}/LICENSE +0 -0
- {lockss_pybasic-0.1.0.dev5 → lockss_pybasic-0.1.0.dev7}/README.rst +0 -0
|
@@ -28,17 +28,63 @@
|
|
|
28
28
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
29
29
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
30
30
|
|
|
31
|
+
'''
|
|
32
|
+
Utilities for command line processing.
|
|
33
|
+
'''
|
|
34
|
+
|
|
35
|
+
from abc import ABC, abstractmethod
|
|
31
36
|
import sys
|
|
32
37
|
|
|
33
|
-
from pydantic.v1
|
|
38
|
+
from pydantic.v1 import BaseModel, Field
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class Printable(ABC):
|
|
42
|
+
|
|
43
|
+
def print(self, file=sys.stdout):
|
|
44
|
+
print(self.get_display(), file=file)
|
|
45
|
+
|
|
46
|
+
@abstractmethod
|
|
47
|
+
def get_display(self):
|
|
48
|
+
pass
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class CopyrightCommand:
|
|
52
|
+
|
|
53
|
+
@staticmethod
|
|
54
|
+
def make(copyright):
|
|
55
|
+
class CopyrightModel(Printable, BaseModel):
|
|
56
|
+
def get_display(self):
|
|
57
|
+
return copyright
|
|
58
|
+
return CopyrightModel
|
|
59
|
+
|
|
60
|
+
@staticmethod
|
|
61
|
+
def field():
|
|
62
|
+
return Field(description='print the copyright and exit')
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class LicenseCommand:
|
|
66
|
+
|
|
67
|
+
@staticmethod
|
|
68
|
+
def make(license):
|
|
69
|
+
class LicenseModel(Printable, BaseModel):
|
|
70
|
+
def get_display(self):
|
|
71
|
+
return license
|
|
72
|
+
return LicenseModel
|
|
73
|
+
|
|
74
|
+
@staticmethod
|
|
75
|
+
def field():
|
|
76
|
+
return Field(description='print the software license and exit')
|
|
77
|
+
|
|
34
78
|
|
|
35
|
-
class VersionCommand
|
|
79
|
+
class VersionCommand:
|
|
36
80
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
81
|
+
@staticmethod
|
|
82
|
+
def make(version):
|
|
83
|
+
class VersionModel(Printable, BaseModel):
|
|
84
|
+
def get_display(self):
|
|
85
|
+
return version
|
|
86
|
+
return VersionModel
|
|
42
87
|
|
|
43
|
-
|
|
44
|
-
|
|
88
|
+
@staticmethod
|
|
89
|
+
def field():
|
|
90
|
+
return Field(description='print the version number and exit')
|
|
File without changes
|
|
File without changes
|