Skip to content

Fondus/Commons-CLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commons-CLI

The standard commons interface of FondUS to write command-line program base on JCommander and zt-exec.

  • The JRE flavor requires JDK 1.8 or higher.

The Parse Command Runner

If your argument implements IHelpArgument, you can use the JCommanderRunner to help parse arguments. No need cast your arguments to actual type.

JCommanderRunner.execute( this.getArgs(), BasicHelpArguments.instance(), "UnitTest", arguments -> {
    Assert.assertFalse( arguments.isHelp() );
    Assert.assertEquals( Paths.get( "src/test/resources" ) , arguments.getBasePath() );
} );

Predefine Basic Commons Interface

  • BasicCommandLineExecute: Will help check the base, input and output path and pass the arguments.
  • ConfigCommandLineExecute: Will help check the base, input, output and config path and pass the arguments.

The Standard Arguments

  • BasicHelpArguments: Just has help options.
Argument Description Default Required
-h / --help Show how to usage. - false
  • BasicArguments: If you don't need the input/output files list, use this please.
Argument Description Default Required
-b / --base The current working directory. - true
-h / --help Show how to usage. - false
-id / --idir The input file folder, relative to the current working directory. Input/ false
-od / --odir The output file folder, relative to the current working directory. Output/ false
  • ConfigArguments: If you need read config/properties, use this please.
Argument Description Default Required
-c / --config The file name of configuration, relative to the current working directory. - true

Dependencies

License

Authors and Contributors

The Commons-CLI libraries are developed by the FondUS Technology Co., Ltd. and are maintained by @Vipcube.

About

The commons interface to write command-line program.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages