All files / fabric-shim/lib/cmds/metadata generateCommand.js

100% Statements 10/10
100% Branches 0/0
100% Functions 2/2
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25          1x   1x   1x 1x 1x 1x       1x   1x     1x 1x    
/*
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
*/
const Generate = require ('./lib/generate.js');
 
'use strict';
 
module.exports.command = 'generate [options]';
module.exports.desc = 'Generate a file containing the metadata from the deployed contract';
module.exports.builder = (yargs) => {
    yargs.options({
        'file': {alias: 'f', required: false, describe: 'The file name/path to save the generated metadata file, if no file is specified, it will print to stdout', type: 'string'},
        'module-path': {alias: 'p', required: false, describe: 'The path to the directory of your smart contract project which contains your chaincode, default is your current working directory', type: 'string', default: process.cwd()}
    });
    yargs.usage('fabric-chaincode-node metadata generate --file "fileName"');
 
    return yargs;
};
 
module.exports.handler = async (argv) => {
    await Generate.handler(argv);
};