ls support for files

This commit is contained in:
b1ek 2023-03-16 14:07:49 +10:00
parent 2651eba0f9
commit 254385faee
Signed by: blek
GPG Key ID: 14546221E3595D0C
8 changed files with 75 additions and 39 deletions

View File

@ -1,7 +1,7 @@
div#resume_js_app { div#resume_js_app {
background: #212121; background: #212121;
width:800px; width:1000px;
height:600px; height:800px;
border: 1px solid #e1e1e1; border: 1px solid #e1e1e1;
border-radius: 6px; border-radius: 6px;
font-family: monospace; font-family: monospace;

View File

@ -23,6 +23,7 @@
"memfs": "^3.4.13", "memfs": "^3.4.13",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"unionfs": "^4.4.0",
"xterm": "^5.1.0", "xterm": "^5.1.0",
"xterm-for-react": "^1.0.4", "xterm-for-react": "^1.0.4",
"xterm-js-shell": "^1.1.3" "xterm-js-shell": "^1.1.3"

View File

@ -4,7 +4,11 @@ let cmds = {
'cmdls': require('./cmds'), 'cmdls': require('./cmds'),
'help': require('./cmds'), 'help': require('./cmds'),
'ls': require('./ls'), 'ls': require('./ls'),
'skills': require('./skills') 'skills': require('./skills'),
// alias l='ls -l'
'l': (a,t) => {require('./ls')([...a, '-l'], t)},
}; };
module.exports = cmds; module.exports = cmds;

View File

@ -26,7 +26,7 @@ module.exports = (argv, terminal) => {
// remove .* files if -a not specified // remove .* files if -a not specified
if (!all) if (!all)
directories = directories.filter(x => x.startsWith('.')); directories = directories.filter(x => !x.startsWith('.'));
// remove arguments // remove arguments
directories = directories.filter(x => !x.startsWith('-')); directories = directories.filter(x => !x.startsWith('-'));
@ -38,23 +38,30 @@ module.exports = (argv, terminal) => {
directories.forEach((dir, i) => { directories.forEach((dir, i) => {
if (!fs.lstatSync(dir).isDirectory()) {
terminal.write(dir);
return;
}
if (directories.length != 1) { if (directories.length != 1) {
terminal.writeln(dir + ':'); terminal.writeln(dir + ':');
terminal.writeln(''); terminal.writeln('');
} }
if (!fs.existsSync(dir)) {
terminal.writeln(`${argv[0]}: cannot access '${dir}': No such file or directory`);
return;
}
let files = fs.readdirSync(dir); let files = fs.readdirSync(dir);
files.forEach((file, i) => { files.forEach((file, i) => {
if (!fs.accessSync(file, fs.constants.X_OK)) if (!long_format)
terminal.write('\033[1;32m'); terminal.write(file + '\033[0m ');
if (fs.accessSync(file, fs.constants.R_OK)) else
terminal.write('\033[35m'); terminal.writeln('drwx-xr-x 1 nobody nobody 4.0K Jan 1 13 01:00 ' + file);
terminal.write(file + '\033[0m ');
if ((i+1) % 5 == 0) if ((i+1) % 5 == 0)
terminal.writeln(''); terminal.writeln('');
}); });
terminal.writeln('');
}) })
terminal.writeln('');
} }

View File

@ -1,4 +1,20 @@
const fs = require('../fs');
module.exports = (argv, terminal) => { module.exports = (argv, terminal) => {
if (argv.indexOf('--help') != -1) {
terminal.writeln(`Usage: ${argv[0]}\nShows my skills info`);
return;
}
if (argv[1] != undefined) {
const file = 'skills/' + argv[1];
if (!fs.existsSync(file))
return;
terminal.write(fs.readFileSync(file));
return;
}
terminal.write(` terminal.write(`
My skills My skills
@ -10,6 +26,7 @@ Learn more: \x1b[4;32mskills web\x1b[0m
\x1b[1;33m[## ] 40% Native C/C++/Rust\x1b[0m \x1b[1;33m[## ] 40% Native C/C++/Rust\x1b[0m
Not really my zone of work but its really fun to Not really my zone of work but its really fun to
make something with these in spare time. make something with these in spare time.
Learn more: \x1b[4;32mskills nt\x1b[0m
\x1b[1;38:5:244m[ ] 0% Being cis\x1b[0m \x1b[1;38:5:244m[ ] 0% Being cis\x1b[0m
Never liked it Never liked it

View File

@ -0,0 +1,12 @@
module.exports = {
'/skills/web': `
My web experience
I don't really know anything about web development,
but I have some projects which are presented below:
blek! Site: Second rewrite of my website. https://github.com/b1ek/blekSite
blek! ID: An auth server. https://github.com/b1ek/blekID
blek! Bin: A pastebin alternative. https://git.blek.codes/blek/bin
homepage.js: Third rewrite of my website. https://git.blek.codes/blek/homepage.js
`
}

View File

@ -1,4 +1,8 @@
const { fs } = require('memfs'); const { fs, vol } = require('memfs');
fs.writeFileSync('README.md', 'uwu'); fs.writeFileSync('README.md', 'uwu');
const { ufs } = require('unionfs');
module.exports = fs; ufs.use(fs).use(vol.fromJSON(require('./files')));
ufs.constants = fs.constants;
module.exports = ufs;

View File

@ -1,52 +1,43 @@
div#resume_js_app { div#resume_js_app {
width: 800px;
height: 600px;
background: #212121; background: #212121;
width:1000px;
height:800px;
border: 1px solid #e1e1e1; border: 1px solid #e1e1e1;
border-radius: 6px; border-radius: 6px;
padding: 8px 2px;
font-family: monospace; font-family: monospace;
transition: all .15s; box-shadow: 0 2px 1px #303030A0;
box-shadow: 0 2px 1px #303030a0;
color: #e1e1e1 !important; color: #e1e1e1 !important;
padding: 8px 2px;
transition: 150ms ease;
} }
div#resume_js_app:hover { div#resume_js_app:hover {
box-shadow: 0 2px 3px #303030; box-shadow: 0 2px 3px #303030;
} }
div#resume_js_app p.js_loading_indicator { div#resume_js_app p.js_loading_indicator {
width: -moz-fit-content; padding: 0; margin: 0;
position: relative;
top: 50%; left: 50%;
transform: translate(-50%, -50%);
width: fit-content; width: fit-content;
text-align: center; text-align: center;
margin: 0;
padding: 0;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
} }
div#resume_js_app * { div#resume_js_app * {
color: #e1e1e1; color: #e1e1e1;
font-family: Source Code Pro, monospace !important; font-family: 'Source Code Pro', monospace !important;
} }
div#resume_js_app a, div#resume_js_app a:visited { div#resume_js_app a, div#resume_js_app a:visited {
text-shadow: 0 0 #24557e30; color: rgb(36, 85, 126) !important;
font-weight: 500;
text-decoration: none; text-decoration: none;
transition: all .15s; font-weight: 500;
color: #24557e !important; transition: 150ms ease;
text-shadow: 0 0 0px #24557e30;
} }
div#resume_js_app a:hover { div#resume_js_app a:hover {
text-shadow: 0 0 4px #24557e30; text-shadow: 0 0 4px #24557e30;
} }
div#resume_js_app table * { div#resume_js_app table * {
border:0;
text-align: left; text-align: left;
border: 0;
} }
/*# sourceMappingURL=resume.css.map */