scfaapm 0.1.0__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.
- scfaapm-0.1.0/LICENSE.txt +21 -0
- scfaapm-0.1.0/PKG-INFO +14 -0
- scfaapm-0.1.0/README.md +3 -0
- scfaapm-0.1.0/pyproject.toml +12 -0
- scfaapm-0.1.0/scfaapm/__init__.py +41 -0
- scfaapm-0.1.0/scfaapm.egg-info/PKG-INFO +14 -0
- scfaapm-0.1.0/scfaapm.egg-info/SOURCES.txt +8 -0
- scfaapm-0.1.0/scfaapm.egg-info/dependency_links.txt +1 -0
- scfaapm-0.1.0/scfaapm.egg-info/top_level.txt +1 -0
- scfaapm-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Swaraaj Arora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
scfaapm-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scfaapm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A flag and argument parser module, made for Python.
|
|
5
|
+
Author: Swaraaj Arora
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE.txt
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# SGM
|
|
13
|
+
|
|
14
|
+
* The sgm module is made by Swaraaj Arora and is a user-friendly GUI framework.
|
scfaapm-0.1.0/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "scfaapm"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A flag and argument parser module, made for Python."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "Swaraaj Arora" }]
|
|
11
|
+
license = "MIT"
|
|
12
|
+
requires-python = ">=3.10"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
class FlagAndArgParser:
|
|
4
|
+
def __init__(self, programname="Program", description="Default description"):
|
|
5
|
+
self.PROGRAM = programname
|
|
6
|
+
self.DESC = description
|
|
7
|
+
self.FLAGSINSERT = set()
|
|
8
|
+
self.ARGSINSERT = {}
|
|
9
|
+
|
|
10
|
+
def AddFlag(self, flagname="flag"):
|
|
11
|
+
self.FLAGSINSERT.add(flagname.lstrip("/"))
|
|
12
|
+
|
|
13
|
+
def AddArgument(self, argname="arg", _type=str):
|
|
14
|
+
self.ARGSINSERT[argname] = _type
|
|
15
|
+
|
|
16
|
+
def Parse(self):
|
|
17
|
+
things = sys.argv[1:]
|
|
18
|
+
args = {}
|
|
19
|
+
flags = []
|
|
20
|
+
|
|
21
|
+
for thing in things:
|
|
22
|
+
# argument: /key=value
|
|
23
|
+
if thing.startswith("/") and "=" in thing:
|
|
24
|
+
key, value = thing[1:].split("=", 1)
|
|
25
|
+
if key in self.ARGSINSERT:
|
|
26
|
+
try:
|
|
27
|
+
args[key] = self.ARGSINSERT[key](value)
|
|
28
|
+
except ValueError:
|
|
29
|
+
raise ValueError(f"Invalid value for /{key}: {value}")
|
|
30
|
+
|
|
31
|
+
# flag: /flag
|
|
32
|
+
elif thing.startswith("/"):
|
|
33
|
+
clean = thing[1:]
|
|
34
|
+
if clean in self.FLAGSINSERT:
|
|
35
|
+
flags.append(clean)
|
|
36
|
+
|
|
37
|
+
return type(
|
|
38
|
+
"ArgsFlags",
|
|
39
|
+
(),
|
|
40
|
+
{"ARGS": args, "FLAGS": flags}
|
|
41
|
+
)()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scfaapm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A flag and argument parser module, made for Python.
|
|
5
|
+
Author: Swaraaj Arora
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE.txt
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# SGM
|
|
13
|
+
|
|
14
|
+
* The sgm module is made by Swaraaj Arora and is a user-friendly GUI framework.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
scfaapm
|
scfaapm-0.1.0/setup.cfg
ADDED