Uploaded image for project: 'EasyAnt'
  1. EasyAnt
  2. EASYANT-30

Refactor EasyAnt main class to use commons-cli

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.9
    • None
    • None

    Description

      We originally forked the Ant's main class to add our options (as the original class was not fully designed to be extends for our needs).

      Then we started implementing new kind of command line switches and called it ManCommands. Thoses ManCommands were designed to make complex features accessible from the commande line like:

      • listTargets : Lists all targets available
      • listTargets [arg] : Lists all targets associated with the specified phase / plugin as argument
      • listPhases : Lists all phases available
      • listPugins : Lists all plugins imported in the current project
      • listProps [plugin] : Lists all properties available in the specified plugin
      • describe [arg] : Describes a phase / target / property specified by argument

      To create new "mancomands" you were obligated to implements ManCommand interface, modify easyant main to "handle" the new switch and modify the usage.

      My concern is about maintenance of "usage" section it was never updated.

      I would suggest to refactor our main class and use an apache library => commons-cli.
      As main advantages, i see "usage" or help generator, an easier and stronger mechanism for parameter handling.
      Commons cli support :
      POSIX like options (ie. tar -zxvf foo.tar.gz)
      GNU like long options (ie. du --human-readable --max-depth=1)
      Java like properties (ie. java -Djava.awt.headless=true -Djava.net.useSystemProxies=true Foo)
      Short options with value attached (ie. gcc -O2 foo.c)
      long options with single hyphen (ie. ant -projecthelp)

      As a minor drawback easyant-core will have one more dependency, but if this is a real problem we could split easyant-core in two distinct module "core", and "cli" where "cli" will containing the main class "ManCommand" and the dependency on Apache commons-cli.

      Attachments

        Activity

          People

            jboudart Jean-Louis Boudart
            jboudart Jean-Louis Boudart
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: