piston/cli/index.js

27 lines
535 B
JavaScript
Raw Permalink Normal View History

2021-03-13 01:19:05 +01:00
#!/usr/bin/env node
2021-03-13 04:44:33 +01:00
const axios = require('axios').default;
const axios_instance = function(argv){
argv.axios = axios.create({
baseURL: argv['piston-url']
});
return argv;
};
2021-02-22 11:38:11 +01:00
require('yargs')(process.argv.slice(2))
.option('piston-url', {
alias: ['u'],
default: 'http://127.0.0.1:6969',
desc: 'Piston API URL',
string: true
})
2021-03-13 04:44:33 +01:00
.middleware(axios_instance)
2021-02-22 11:38:11 +01:00
.scriptName("piston")
.commandDir('commands')
.demandCommand()
.help()
.wrap(72)
2021-03-13 04:44:33 +01:00
.argv;