2 ms·
Elegant, but then it's no longer a basic shell-script as it requires python installed. If you can live with additional dependencies, then I like the node [1] c
by gitgud 6y ago
Elegant, but then it's no longer a basic shell-script as it requires python installed.
If you can live with additional dependencies, then I like the node [1] commander package, which is very readable and nice to work with in my opinion.
#!/usr/bin/env node
const { program } = require('commander');
program
.command('clone <source> [destination]')
.description('clone a repository')
.action((source, destination) => {
console.log('clone command called');
});
It also automatically generates the --help output for ./script -h
[1] https://github.com/tj/commander.js/ https://github.com/tj/commander.js/