SYNOPSIS

    In your Rinci function metadata:

     {
         v => 1.1,
         summary => 'Some function',
         args => {
             file => {
                 # specification for 'file' argument
                 schema  => 'str*',
                 'x.schema.entity' => 'filename',
             },
             url => {
                 # specification for 'url' argument
                 schema  => ['array*', of => 'str*'],
                 'x.schema.element_entity' => 'riap_url',
             },
         },
     }

    Now in command-line application:

     % myprog --file <tab>

    will use completion routine from function complete_arg_val in module
    Perinci::Sub::ArgEntity::filename, while:

     % myprog --url <tab>

    will use element completion routine from function complete_arg_val in
    module Perinci::Sub::ArgEntity::riap_url.

DESCRIPTION

    The namespace Perinci::Sub::ArgEntity::* is used to put data and
    routine related to certain types (entities) of function arguments.

 Completion

    The idea is: instead of having to put completion routine (coderef)
    directly in argument specification, like:

     file => {
         # specification for 'file' argument
         schema  => 'str*',
         completion => \&Complete::Util::complete_file,
     },

    you just specify the argument as being of a certain entity using the
    attribute x.schema.entity:

     file => {
         # specification for 'file' argument
         schema  => 'str*',
         'x.schema.entity' => 'filename',
     },

    and module like Perinci::Sub::Complete will search the appropriate
    completion routine (if any) for your argument. In this case, it will
    search for the module named Perinci::Sub::ArgEntity:: + entity_name and
    then look up the function complete_arg_val.

    Note that aside from completion, there are other uses for the
    x.schema.entity attribute, e.g. in help message generation, etc. More
    things will be formally specified in the future.

SEE ALSO

    Rinci, Rinci::function

    Complete, Perinci::Sub::Complete

