Compare commits
2 Commits
3e3553fd81
...
ca14f60779
Author | SHA1 | Date |
---|---|---|
b1ek | ca14f60779 | |
b1ek | 0eb20603ac |
|
@ -12,6 +12,7 @@ let cmds = {
|
|||
'zsh': require('./zsh'),
|
||||
'ps': require('./ps'),
|
||||
'clear': require('./clear'),
|
||||
'rm': require('./rm'),
|
||||
|
||||
// alias l='ls -l'
|
||||
'l': (a,t) => {require('./ls')([...a, '-l'], t)},
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
const { Terminal } = require("xterm");
|
||||
const fs = require('../fs')
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string[]} argv
|
||||
* @param {Terminal} terminal
|
||||
*/
|
||||
module.exports = (argv, terminal) => {
|
||||
if (argv.indexOf('--help') != -1) {
|
||||
terminal.write(
|
||||
`Usage: ${argv[0]} [...FILES] [OPTIONS]
|
||||
Delete specified flies
|
||||
-r -R --recursive Recursively delete all files in directory
|
||||
-f --force Ignore nonexistant files and arguments
|
||||
`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let files = [...argv];
|
||||
files.shift();
|
||||
files = files.filter(file => !file.startsWith('-'));
|
||||
|
||||
let args = [...argv].filter(arg => arg.startsWith('-'));
|
||||
|
||||
// explode -abc => -a -b -c
|
||||
args.forEach((arg, i) => {
|
||||
if (arg.match(/-\w{2,}/)) {
|
||||
args.splice(i, 1);
|
||||
arg.substring(1).split('').forEach(part => args.push('-' + part));
|
||||
}
|
||||
})
|
||||
|
||||
const recursive = args.indexOf('-r') != -1;
|
||||
const force = args.indexOf('-f') != -1;
|
||||
|
||||
files.forEach(file => {
|
||||
try {
|
||||
const stat = fs.lstatSync(file);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
if (!recursive) {
|
||||
if (!force)
|
||||
terminal.writeln(`${argv[0]}: cannot remove ${file}: is a directory`);
|
||||
return -1;
|
||||
}
|
||||
fs.readdirSync(file).forEach(file => fs.unlinkSync(file));
|
||||
fs.rmdirSync(file);
|
||||
}
|
||||
fs.unlinkSync(file);
|
||||
} catch (err) {
|
||||
if (!force)
|
||||
terminal.writeln(`${argv[0]}: cannot remove ${file}: ${err}`);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
module.exports = {
|
||||
|
||||
|
||||
'/skills/web': `
|
||||
\x1b[1mMy web experience\x1b[0m
|
||||
I don't really know anything about web development,
|
||||
|
@ -9,6 +11,8 @@ 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
|
||||
`,
|
||||
|
||||
|
||||
'/skills/nt': `
|
||||
Me native dev experience
|
||||
It isn't much but i do have a couple of projects
|
||||
|
@ -18,5 +22,23 @@ CuteSchedule A school project that is
|
|||
supposed to be a interactive https://github.com/b1ek/CuteSchedule
|
||||
schedule menu hanging on
|
||||
a TV
|
||||
f2bin Convert files into C code https://github.com/b1ek/f2bin`
|
||||
f2bin Convert files into C code https://github.com/b1ek/f2bin`,
|
||||
|
||||
|
||||
'README.md':
|
||||
`\x1b[1m# My online resume\x1b[0m
|
||||
Hi! Welcome on my online resume. This app was made with React and XTerm.JS
|
||||
My name is Alice and I like to build software.
|
||||
|
||||
\x1b[1m# My skills\x1b[0m
|
||||
|
||||
\x1b[1;32m[#####] 100% Web development (PHP,JS,Postgres)\x1b[0m
|
||||
More: \x1b[4mskills web\x1b[0m
|
||||
|
||||
\x1b[1;31m[## ] 40% Native dev (C/C++/Rust)\x1b[0m
|
||||
More: \x1b[4mskills nt\x1b[0m
|
||||
|
||||
\x1b[36m[ ] 0% Being cis\x1b[0m
|
||||
Really suck at this
|
||||
`
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
const { fs, vol } = require('memfs');
|
||||
fs.writeFileSync('README.md', 'uwu');
|
||||
const { ufs } = require('unionfs');
|
||||
|
||||
ufs.use(fs).use(vol.fromJSON(require('./files')));
|
||||
|
|
Loading…
Reference in New Issue