Args | New naked Executable Command

A new args command is available for the naked executable that will help you design your application logic if you use the Naked command parser.  All parsed strings, truth testing for options, and string assignments for arguments to options and flags are displayed for any example command that you provide.

For example, use the command:

naked args 'testapp save somestring --unicode -s --name=file.txt'

and you get this:

Application
-----------
c.app = testapp

Argument List Length
--------------------
c.argc = 5

Argument List Items
-------------------
c.argobj = ['save', 'somestring', '--unicode', '-s', '--name=file.txt']

Arguments by Zero Indexed Start Position
----------------------------------------
c.arg0 = save
c.arg1 = somestring
c.arg2 = --unicode
c.arg3 = -s
c.arg4 = --name=file.txt

Arguments by Named Position
---------------------------
c.first = save
c.second = somestring
c.third = --unicode
c.fourth = -s
c.fifth = --name=file.txt

Last Positional Argument
------------------------
c.arglp = --name=file.txt
c.last = --name=file.txt

Primary & Secondary Commands
----------------------------
c.cmd = save
c.cmd2 = somestring

Option Exists Tests
------------------
c.option_exists() = True
c.options = True

Option Argument Assignment
--------------------------
c.arg("--unicode") = -s
c.arg("-s") = --name=file.txt

Flag Exists Tests
----------------
c.flag_exists() = True
c.flags = True

Flag Argument Assignment
------------------------
c.flag_arg("--name") = file.txt

Details are available here.

Advertisements