Add argparse module

This commit is contained in:
Shunsuke Shibayama 2022-10-22 17:58:20 +09:00
parent 22857229ee
commit 6fc382d46c
2 changed files with 18 additions and 2 deletions

View file

@ -0,0 +1,14 @@
._StoreAction: ClassType
.ArgumentParser!: ClassType
.new = 'ArgumentParser': (description := Str, prog := Str) -> .ArgumentParser!
.ArgumentParser!.add_argument!: (
name: Str, # TODO: var-args
action := Str or NoneType,
default := Obj or NoneType,
type := Type,
required := Bool,
help := Str or NoneType,
choices := Obj or NoneType,
) => ._StoreAction
.ArgumentParser!.parse_args!: (args := Str or [Str; _] or NoneType,) => Obj # TODO: type with dependent types