[+] add parse_args
This commit is contained in:
parent
723c5b6677
commit
9e117048dc
27
python/online/fxreader/pr34/commands_typed/argparse.py
Normal file
27
python/online/fxreader/pr34/commands_typed/argparse.py
Normal file
@ -0,0 +1,27 @@
|
||||
__all__ = (
|
||||
'parse_args',
|
||||
)
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
from typing import (Optional,)
|
||||
|
||||
def parse_args(
|
||||
parser: argparse.ArgumentParser,
|
||||
args: Optional[list[str]] = None,
|
||||
) -> tuple[argparse.Namespace, list[str]]:
|
||||
if args is None:
|
||||
args = sys.argv[1:]
|
||||
|
||||
argv : list[str] = []
|
||||
|
||||
for i, o in enumerate(args):
|
||||
if o == '--':
|
||||
argv.extend(args[i + 1:])
|
||||
|
||||
del args[i:]
|
||||
|
||||
break
|
||||
|
||||
return parser.parse_args(args), argv
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = 'online.fxreader.pr34'
|
||||
version = '0.1.4.13'
|
||||
version = '0.1.4.14'
|
||||
|
||||
dependencies = [
|
||||
#"-r requirements.txt",
|
||||
|
BIN
releases/whl/online_fxreader_pr34-0.1.4.14-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.4.14-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user