
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
CLI Argument Parser Functions
pip3 install sysarg
import SysArg
arg=SysArg.SysArg(program='ArgTest',desc='ARG. Testing',version='1.0')
if you want make a special command in this application case: (ArgTest command ...)
import SysArg
arg=SysArg.SysArg(program='ArgTest',desc='ARG. Testing',version='1.0',cmd_id=1)
example format: -n, --numbre=INT
arg.define('number',short='-n',long='--number',params_name='INT',type=int,desc='Number Input')
it this option required value
arg.define('number',short='-n',long='--number',params_name='INT',type=int,desc='Number Input',required=True)
Add some of GROUP(ex: INPUT)
arg.define('number',short='-n',long='--number',params_name='INT',type=int,desc='Number Input',group='INPUT')
example format: -n, --numbre INT
arg.define('number',short='-n',long='--number',params=1,type=int,desc='Number Input')
example format: -l, --list ['A','B']
arg.define('List',short='-l',long='--list',params=1,type=list,desc='List Input')
example format: -l, --list 'A,B,C'
arg.define('List',short='-l',long='--list',params=1,type=list,spliter=',',desc='List Input')
example format: -l, --list A B C
arg.define('List',short='-l',long='--list',params=3,type=list,desc='List Input')
example default : if not input then default get 7
arg.define('N',short='-n',long='--number',params=1,type=int,desc='Number Input',default=7)
example check parameter: if -n or --number parameter then True
arg.define('N',short='-n',long='--number')
example command group:
arg.define(group_desc='File list',group='ls',command=True)
arg.define('show_detail',short='-l',desc='show detail',group='ls')
arg.define('show_time',short='-t',desc='show time',group='ls')
arg.define('number',short='-n',long='--number',params_name='INT',type=int,desc='Number Input',group='INPUT')
arg.define(group_desc='Power command',group='power',command=True,arg=True,select=['on','off','reset'])
cmd=arg.Cmd()
Check input 'command'
if arg.Cmd('command'):
~~~~
else:
~~~~
param=arg.Get()
param=arg.Get(group='INPUT')
# ./APP power -i x.x.x.x on
if arg.Cmd('power'):
pw_cmd=arg.Get(group='power')
if pw_cmd == 'on':
...
elif pw_cmd == 'off':
...
....
param=arg.Get('number')
param=arg.Get('List',group='INPUT')
Simple Example)
import SysArg
arg=SysArg.SysArg(program='ArgTest',desc='ARG. Testing',version='1.0',cmd_id=1)
arg.define('a',short='-a',long='--abc',desc='test input',params=1)
arg.define(group_desc='test command',group='ls',command=True)
arg.define('detail',short='-l',desc='show detail',group='ls')
arg.define('find_time',short='-t',desc='find time',group='ls',params=1)
arg.Version()
arg.Help()
cmd=arg.Cmd()
a=arg.Get('a')
Output:
$ python3 a.py --help
Usage: ArgTest <command> [OPTION] [<args>]
Version: 1.0
ARG. Testing
Supported <command>s are:
ls test command
[OPTION]
-h, --help Help
-a, --abc test input(input(1):S)
* ls test command
-l show detail
-t find time(input(1):S)
FAQs
CLI Argument Parser
We found that sysarg demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.