chore: bruno cli accept request filename

This commit is contained in:
Anoop M D 2023-02-06 02:57:59 +05:30
parent e26075060e
commit 404a516fef
2 changed files with 35 additions and 8 deletions

View File

@ -10,7 +10,9 @@
"package.json"
],
"dependencies": {
"chalk": "^5.2.0",
"@usebruno/js": "0.1.0",
"@usebruno/lang": "0.1.0",
"chalk": "^3.0.0",
"inquirer": "^9.1.4",
"yargs": "^17.6.2"
}

View File

@ -1,18 +1,43 @@
const chalk = require('chalk');
const {
CLI_EPILOGUE,
} = require('../constants');
const command = 'run';
const desc = 'Run request';
const desc = 'Run a request';
const cmdArgs = {
filename: {
desc: 'Run a request',
type: 'string',
}
};
const builder = async (yargs) => {
try {
console.log(chalk.yellow('Running request'));
} catch (err) {
console.error(err);
}
yargs.options(cmdArgs).epilogue(CLI_EPILOGUE).help();
yargs.example('$0 filename', 'Run a request');
};
const handler = async function (argv) {
try {
if (!argv.filename) {
console.log(chalk.cyan('Please specify a filename'));
console.log(`Example: ${argv.$0} run request.bru`);
return;
}
console.log("here");
} catch (err) {
console.error(err);
}
};
module.exports = {
command,
desc,
builder
builder,
cmdArgs,
handler
};