Generate help from CLI
blcham opened this issue · comments
Miroslav Blaško commented
When script is run without parameters or with bad parameters or with --help
, information about parameters should be shown. It should return similar input as following bash script:
if [ $# -lt 4 ];
then
echo "ERROR: all 4 parameters should be passed";
echo "Usage: bpmn2stamp.sh <bpmn_file> <actor_mapping_xml> <organization_structure_xml> <result_ontology_base_iri>"
echo "where:"
echo " bpmn_file - bpmn file to convert"
echo " actor_mapping_xml - actor mapping file for bpmn processes"
echo " organization_structure_xml - organization structure file"
echo " result_ontology_base_iri - base iri for the output ontology"
exit 1;
fi;
echo "Passed parameters:"
echo " bpmn_file = "$bpmn_file
echo " actor_mapping_xml = "$actor_mapping
echo " organization_structure_xml = "$organization_structure
echo " result_ontology_base_iri = "$base_iri
echo " output ontology file name (automatically derived from bpmn_xml) = "$output_file
echo ""
echo "Executing bpmn2stamp converter (using stamp execution stamp - see converter documentation):"
echo "-------------------------------------------------------------------------------------------------------"
echo "java -jar bpmn2stamp.jar -t stamp -iam \"$actor_mapping\" -ibpmn \"$bpmn_file\" -iorg \"$organization_structure\" -iri \"$base_iri\" -o \"$output_file\""
A/C:
- generated help is outputted to the console if CLI is incorrectly used
Miroslav Blaško commented
@grigobog
BTW, I have read your code to process CLI arguments and not sure it must be that complicated, on next meeting I will explain how parsing with org.kohsuke.args4j works:
https://github.com/kbss-cvut/s-pipes/blob/main/s-pipes-cli/src/main/java/cz/cvut/spipes/cli/ExecuteModuleCLI.java
grigobog commented