require ( "source-map-support" ) . install ( ) ; import { makeBooleanFlag , makeNumberFlag , makeStringFlag , makeCommand , reduceFlag , makeStringArgument , makePositionalArguments } from "../main" ; const booleanFlag = makeBooleanFlag ( "opts1" , { usage : "boolean example" } ) ; const numberFlag = makeNumberFlag ( "opts2" , { default : 1 , usage : "number example" } ) ; const stringFlag = makeStringFlag ( "opts3" , { alias : "a" , usage : "string example" } ) ; const stringArg = makeStringArgument ( "arg1" ) ; const flags = reduceFlag ( booleanFlag , numberFlag , stringFlag ) ; const args = makePositionalArguments ( stringArg ) ; const command = makeCommand ( { name : "example" , description : "catacli is typescript-friendly commander tool" , version : "0.0.1" , usage : "simple [OPTIONS] arg1" , flag : flags , positionalArguments : args , handler : ( args , opts ) => { console . log ( "positionalArgs: " , args . arg1 . value ) ; console . log ( "flag opts1: " , opts . opts1 . value ) ; console . log ( "flag opts2: " , opts . opts2 . value ) ; console . log ( "flag opts3: " , opts . opts3 . value ) ; } } ) ; command ( process . argv . splice ( 2 ) ) ;