Compare commits
No commits in common. "a598fa9364e7a09de91daf585b0647490b9cba2a" and "a326c8f6b861eecbed5ae30ea8339e6195f1c448" have entirely different histories.
a598fa9364
...
a326c8f6b8
|
@ -8,10 +8,9 @@ const fs = require('../fs');
|
||||||
*/
|
*/
|
||||||
module.exports = (argv, terminal) => {
|
module.exports = (argv, terminal) => {
|
||||||
if (argv.indexOf('--help') != -1) {
|
if (argv.indexOf('--help') != -1) {
|
||||||
terminal.writeln(`Usage: ${argv[0]} [files] [-n]`);
|
terminal.writeln('Usage: cat [file] [-n]');
|
||||||
terminal.writeln(' -n --number: show lines numbers');
|
terminal.writeln(' -n --number: show lines numbers');
|
||||||
terminal.writeln(' --help: show this help');
|
terminal.writeln(' --help: show this help');
|
||||||
terminal.writeln('Reads file into stdout');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const numbers = (argv.indexOf('-n') != -1) || (argv.indexOf('--number') != -1);
|
const numbers = (argv.indexOf('-n') != -1) || (argv.indexOf('--number') != -1);
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import { Terminal } from 'xterm';
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {string[]} argv
|
|
||||||
* @param {Terminal} terminal
|
|
||||||
*/
|
|
||||||
module.exports = (argv, terminal) => {
|
|
||||||
if (argv.indexOf('--help') != -1) {
|
|
||||||
terminal.writeln(`Usage: ${argv[0]} [--help]`);
|
|
||||||
terminal.writeln('Lists all available commands.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const cmds = Object.keys(require('../commands'));
|
|
||||||
let i = 0;
|
|
||||||
cmds.forEach(x => {
|
|
||||||
if (x == argv[0]) return;
|
|
||||||
if (i == 4) {
|
|
||||||
terminal.writeln('');
|
|
||||||
i = 0;
|
|
||||||
} else i++;
|
|
||||||
terminal.write('\033[1;32m' + x + '\033[0m ');
|
|
||||||
});
|
|
||||||
terminal.writeln('');
|
|
||||||
}
|
|
|
@ -1,8 +1,5 @@
|
||||||
let cmds = {
|
let cmds = {
|
||||||
'cat': require('./cat'),
|
'cat': require('./cat')
|
||||||
'cmds': require('./cmds'),
|
|
||||||
'cmdls': require('./cmds'),
|
|
||||||
'help': require('./cmds')
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = cmds;
|
module.exports = cmds;
|
Loading…
Reference in New Issue