Updated console

This commit is contained in:
Zakary Timson 2022-05-03 17:03:42 -04:00
parent ce0e7dcc98
commit cf05d96812
3 changed files with 26 additions and 19 deletions

View File

@ -20,13 +20,16 @@ export class ConsoleComponent {
clear() { this.output = []; } clear() { this.output = []; }
exec(input: string, output: () => any, pause = 1000) { exec(input: string, output: () => any, pause = 1000) {
return new Promise<void>(res => {
this.done = async () => { this.done = async () => {
await sleep(pause); await sleep(pause);
this.input = ''; this.input = '';
this.output.push(`${this.prompt} ${input}`); this.output.push(`${this.prompt} ${input}`);
const out = output(); const out = output();
if(typeof out == 'string') this.output.push(out); if(typeof out == 'string') this.output.push(out);
res();
}; };
this.input = input; this.input = input;
});
} }
} }

View File

@ -7,7 +7,13 @@ export class QuoteService {
'Some one at Google was like "Yea, just have someone drive down every road on earth!"', 'Some one at Google was like "Yea, just have someone drive down every road on earth!"',
'Anxiety is like when video game combat music is playing but you can\'t find the enemy', 'Anxiety is like when video game combat music is playing but you can\'t find the enemy',
'Why do kamikaze pilots wear helmets?', 'Why do kamikaze pilots wear helmets?',
'The cake is a lie!' 'The cake is a lie!',
'How are unicorns fake but giraffes real?',
'The number of people older than you never goes up',
'When you brush your teeth you are cleaning your skeleton',
'Pregenancy is like a group project where one person get\'s stuck with all the work',
'If the universe wasn\'t inifinate it would be even scarier',
'Either we are alone in the universe or we are not. both are terrifying'
]; ];
random() { random() {

View File

@ -16,12 +16,10 @@ export class HomeComponent implements AfterViewInit {
animateConsole() { animateConsole() {
setTimeout(async () => { setTimeout(async () => {
this.console.exec('bash ./random-thought.sh', () => this.quotes.random()); await this.console.exec('bash ./random-thought.sh', () => this.quotes.random());
await sleep(10000); await sleep(10000);
this.console.exec('clear', async () => { await this.console.exec('clear', async () => this.console.clear());
this.console.clear();
this.animateConsole(); this.animateConsole();
});
}, 1000); }, 1000);
} }
} }