Compare commits
No commits in common. "0d55e924be17f23f5248b5ec59fffed1d4cf9bb4" and "a598fa9364e7a09de91daf585b0647490b9cba2a" have entirely different histories.
0d55e924be
...
a598fa9364
|
@ -7,7 +7,7 @@ div#resume_js_app {
|
|||
font-family: monospace;
|
||||
box-shadow: 0 2px 1px #303030A0;
|
||||
color: #e1e1e1 !important;
|
||||
padding: 8px 2px;
|
||||
padding: 2px;
|
||||
transition: 150ms ease;
|
||||
}
|
||||
div#resume_js_app:hover {
|
||||
|
|
|
@ -15,8 +15,7 @@ export class Console extends React.Component {
|
|||
theme: {
|
||||
background: '#212121',
|
||||
brightGreen: '#15a179'
|
||||
},
|
||||
convertEol: true
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>;
|
||||
|
|
|
@ -9,9 +9,9 @@ const fs = require('../fs');
|
|||
module.exports = (argv, terminal) => {
|
||||
if (argv.indexOf('--help') != -1) {
|
||||
terminal.writeln(`Usage: ${argv[0]} [files] [-n]`);
|
||||
terminal.writeln(' -n --number show lines numbers');
|
||||
terminal.writeln(' --help show this help');
|
||||
terminal.writeln('Read files into stdout');
|
||||
terminal.writeln(' -n --number: show lines numbers');
|
||||
terminal.writeln(' --help: show this help');
|
||||
terminal.writeln('Reads file into stdout');
|
||||
return;
|
||||
}
|
||||
const numbers = (argv.indexOf('-n') != -1) || (argv.indexOf('--number') != -1);
|
||||
|
@ -20,16 +20,11 @@ module.exports = (argv, terminal) => {
|
|||
files.shift();
|
||||
files.forEach(file => {
|
||||
const lines = fs.readFileSync(file).toString().split('\n');
|
||||
|
||||
if (numbers) {
|
||||
lines.forEach((line, i) => {
|
||||
terminal.write('\033[35m' + i + ' |\033[0m ');
|
||||
})
|
||||
} else {
|
||||
terminal.write(file);
|
||||
/// print % if no newline at eof
|
||||
if (lines[lines.length - 1] != '')
|
||||
terminal.write('\033[30;47m%\033[0m\n');
|
||||
}
|
||||
let i = 1;
|
||||
lines.forEach(line => {
|
||||
if (numbers) terminal.write('\033[35m' + i + ' |\033[0m ');
|
||||
terminal.writeln(line);
|
||||
i++;
|
||||
})
|
||||
})
|
||||
}
|
|
@ -2,9 +2,7 @@ let cmds = {
|
|||
'cat': require('./cat'),
|
||||
'cmds': require('./cmds'),
|
||||
'cmdls': require('./cmds'),
|
||||
'help': require('./cmds'),
|
||||
'ls': require('./ls'),
|
||||
'skills': require('./skills')
|
||||
'help': require('./cmds')
|
||||
};
|
||||
|
||||
module.exports = cmds;
|
|
@ -1,60 +0,0 @@
|
|||
const { Terminal } = require('xterm');
|
||||
const fs = require('../fs');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string[]} argv
|
||||
* @param {Terminal} terminal
|
||||
*/
|
||||
module.exports = (argv, terminal) => {
|
||||
if (argv.indexOf('--help') != -1) {
|
||||
terminal.writeln(`Usage: ${argv[0]} [dirs] [-a|--all] [-l]`);
|
||||
terminal.writeln('Lists files in directories');
|
||||
terminal.writeln(' -a --all List all files (including those who start with .)');
|
||||
terminal.writeln(' -l Use long listing format');
|
||||
return;
|
||||
}
|
||||
|
||||
const has_arg = (arg) => {return argv.indexOf(arg) != -1};
|
||||
|
||||
let directories = [...argv];
|
||||
|
||||
const all = (has_arg('-a') || has_arg('--all'));
|
||||
const long_format = has_arg('-l');
|
||||
|
||||
directories.shift();
|
||||
|
||||
// remove .* files if -a not specified
|
||||
if (!all)
|
||||
directories = directories.filter(x => x.startsWith('.'));
|
||||
|
||||
// remove arguments
|
||||
directories = directories.filter(x => !x.startsWith('-'));
|
||||
|
||||
if (directories.length == 0) directories = ['.'];
|
||||
|
||||
// remove dublicates
|
||||
directories = [...new Set(directories)];
|
||||
|
||||
directories.forEach((dir, i) => {
|
||||
|
||||
if (directories.length != 1) {
|
||||
terminal.writeln(dir + ':');
|
||||
terminal.writeln('');
|
||||
}
|
||||
|
||||
let files = fs.readdirSync(dir);
|
||||
files.forEach((file, i) => {
|
||||
|
||||
if (!fs.accessSync(file, fs.constants.X_OK))
|
||||
terminal.write('\033[1;32m');
|
||||
if (fs.accessSync(file, fs.constants.R_OK))
|
||||
terminal.write('\033[35m');
|
||||
|
||||
terminal.write(file + '\033[0m ');
|
||||
if ((i+1) % 5 == 0)
|
||||
terminal.writeln('');
|
||||
});
|
||||
terminal.writeln('');
|
||||
})
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = (argv, terminal) => {
|
||||
terminal.write('uwu\nowo\n');
|
||||
}
|
|
@ -4,7 +4,7 @@ div#resume_js_app {
|
|||
background: #212121;
|
||||
border: 1px solid #e1e1e1;
|
||||
border-radius: 6px;
|
||||
padding: 8px 2px;
|
||||
padding: 2px;
|
||||
font-family: monospace;
|
||||
transition: all .15s;
|
||||
box-shadow: 0 2px 1px #303030a0;
|
||||
|
|
Loading…
Reference in New Issue