mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-27 22:54:07 +00:00
chore: bruno cli accept request filename
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user