diff options
Diffstat (limited to 'tools/tools-common/src/site-docs')
-rw-r--r-- | tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc | 4 | ||||
-rw-r--r-- | tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc b/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc index 031a3776d..178799c44 100644 --- a/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc +++ b/tools/tools-common/src/site-docs/adoc/fragments/example-cli-version.adoc @@ -22,14 +22,14 @@ First, create a new CLI Parser object, add some options (in the example an optio [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersion.java[tags=setupParser,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java[tags=setupParser,indent=0] ---- Next, we check if the version option was used in the command line and print application name and version if it was used: [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersion.java[tags=processCliVersion,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleAppVersionTest.java[tags=processCliVersion,indent=0] ---- The output will be: diff --git a/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc b/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc index 32a0e957b..d2edc446d 100644 --- a/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc +++ b/tools/tools-common/src/site-docs/adoc/fragments/example-cli.adoc @@ -34,7 +34,7 @@ Manually importing means to add the following lines to the start of your applica [source,java, linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=import,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=import,indent=0] ---- Now, inside your `main()` method, start setting some general application properties. @@ -43,7 +43,7 @@ For instance: [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=setApp,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=setApp,indent=0] ---- Next, create a new CLI Parser and add a few CLI options from the standard `CliOptions`. @@ -51,14 +51,14 @@ The following example adds options for help, version, and a model file: [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=setCli,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=setCli,indent=0] ---- Next, parse the given CLI arguments: [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=parseCli,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=parseCli,indent=0] ---- Once the command line is parsed, we can look into the individual options, check if they are set, and then act accordingly. @@ -67,7 +67,7 @@ If the option is present, we print a help screen and return: [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=processCliHelp,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliHelp,indent=0] ---- Next, we process the option for __version__. @@ -76,7 +76,7 @@ The CLI Parser already provides a method to obtain the correct version for an AP [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=processCliVersion,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliVersion,indent=0] ---- Once help and version arguments are processed, we can proceed to look at all other options. @@ -86,7 +86,7 @@ If we cannot load a model, we print an error and return. [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=processCliModel,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=processCliModel,indent=0] ---- With a model file being loadable, we finish parsing command line arguments. @@ -94,7 +94,7 @@ We also print some status messages to note that the application now is ready to [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=someStartPrint,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=someStartPrint,indent=0] ---- The last action now is to run the actual application. @@ -102,7 +102,7 @@ The example below is taken from a version of the `Model2Cli` application, which [source,java,linenums,subs="attributes+"] ---- -include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParser.java[tags=yourApp,indent=0] +include::{adsite-tools-common-dir}/test/java/org/onap/policy/apex/tools/common/docs/ExampleCliParserTest.java[tags=yourApp,indent=0] ---- If this new application is now called with the command line `-h` or `--help` it will print the following help screen: |