Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for flag parameters in comments of a flag #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 7, 2019

  1. Support for flag parameters in comments of a flag

    This commit introduces the ability to add a parameter describtion for a flag, so it will appear in the in the syntax of the doc of the cli.
    This way you can write clis that gives better hinting of how to use the cli based app.
    
    Parameters are marked with '@param' following the Javadoc-styled documentation standard.
    The following example has a flag called 'path' that expects a directory name
    
    class MyFlags {
     /**
            @param <directory>
            Search in 'directory'
     **/
    @:flag('path')
     public var path:String = null;
     .
     .
     .
    }
    
    Cli.getDoc(new MyFlags(), new tink.cli.doc.DefaultFormatter() will then give this output:
    
    Usage:
     --path, -p<directory> : Search in path of 'directory'
    
    - Only the first occurence of @param is used since a flag only accepts one value,
    - Lines with @params are removed from the comments before the are added to the doc of the flag.
    mikkelmr committed Nov 7, 2019
    Configuration menu
    Copy the full SHA
    d40d649 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2019

  1. Configuration menu
    Copy the full SHA
    364cb13 View commit details
    Browse the repository at this point in the history