function bashCompletionFromOptions(args) {
    assert.object(args, 'args');
    assert.object(args.options, 'args.options');
    assert.string(args.name, 'args.name');
    assert.optionalString(args.specExtra, 'args.specExtra');
    assert.optionalArrayOfString(args.argtypes, 'args.argtypes');

    // Gather template data.
    var data = {
        name: args.name,
        date: new Date(),
        spec: bashCompletionSpecFromOptions({
            options: args.options,
            argtypes: args.argtypes
        }),
    };
    if (args.specExtra) {
        data.spec += '\n\n' + args.specExtra;
    }

    // Render template.
    var template = fs.readFileSync(BASH_COMPLETION_TEMPLATE_PATH, 'utf8');
    return renderTemplate(template, data);
}
Return a string suitable for a Bash completion file for this tool.

@param args.name {String} The tool name.
@param args.options {Array} The array of dashdash option specs.
@param args.specExtra {String} Optional. Extra Bash code content to add
     to the end of the "spec". Typically this is used to append Bash
     "complete_TYPE" functions for custom option types. See
     "examples/ddcompletion.js" for an example.
@param args.argtypes {Array} Optional. Array of completion types for
     positional args (i.e. non-options). E.g.
         argtypes = ['fruit', 'veggie', 'file']
     will result in completion of fruits for the first arg, veggies for the
     second, and filenames for the third and subsequent positional args.
     If not given, positional args will use Bash's 'default' completion.
     See `specExtra` for providing Bash `complete_TYPE` functions, e.g.
     `complete_fruit` and `complete_veggie` in this example.